Merge branch '859-notifications-not-possible-to-refuse-a-follow-request' into 'develop'
Resolve "Notifications: not possible to refuse a follow request" Closes #859 See merge request funkwhale/funkwhale!974
This commit is contained in:
commit
b38a72e129
|
@ -0,0 +1 @@
|
||||||
|
Added ability to reject library follows from notifications screen (#859)
|
|
@ -8,10 +8,14 @@
|
||||||
|
|
||||||
</router-link>
|
</router-link>
|
||||||
<template v-else v-html="notificationData.message"></template>
|
<template v-else v-html="notificationData.message"></template>
|
||||||
<template v-if="notificationData.action">
|
<template v-if="notificationData.acceptFollow">
|
||||||
<div @click="handleAction(notificationData.action.handler)" :class="['ui', 'basic', 'tiny', notificationData.action.buttonClass || '', 'button']">
|
<div @click="handleAction(notificationData.acceptFollow.handler)" :class="['ui', 'basic', 'tiny', notificationData.acceptFollow.buttonClass || '', 'button']">
|
||||||
<i v-if="notificationData.action.icon" :class="[notificationData.action.icon, 'icon']" />
|
<i v-if="notificationData.acceptFollow.icon" :class="[notificationData.acceptFollow.icon, 'icon']" />
|
||||||
{{ notificationData.action.label }}
|
{{ notificationData.acceptFollow.label }}
|
||||||
|
</div>
|
||||||
|
<div @click="handleAction(notificationData.rejectFollow.handler)" :class="['ui', 'basic', 'tiny', notificationData.rejectFollow.buttonClass || '', 'button']">
|
||||||
|
<i v-if="notificationData.rejectFollow.icon" :class="[notificationData.rejectFollow.icon, 'icon']" />
|
||||||
|
{{ notificationData.rejectFollow.label }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</td>
|
</td>
|
||||||
|
@ -38,10 +42,12 @@ export default {
|
||||||
labels () {
|
labels () {
|
||||||
let libraryFollowMessage = this.$pgettext('Content/Notifications/Paragraph', '%{ username } followed your library "%{ library }"')
|
let libraryFollowMessage = this.$pgettext('Content/Notifications/Paragraph', '%{ username } followed your library "%{ library }"')
|
||||||
let libraryAcceptFollowMessage = this.$pgettext('Content/Notifications/Paragraph', '%{ username } accepted your follow on library "%{ library }"')
|
let libraryAcceptFollowMessage = this.$pgettext('Content/Notifications/Paragraph', '%{ username } accepted your follow on library "%{ library }"')
|
||||||
|
let libraryRejectMessage = this.$pgettext('Content/Notifications/Paragraph', 'You rejected %{ username }'s request to follow "%{ library }"')
|
||||||
let libraryPendingFollowMessage = this.$pgettext('Content/Notifications/Paragraph', '%{ username } wants to follow your library "%{ library }"')
|
let libraryPendingFollowMessage = this.$pgettext('Content/Notifications/Paragraph', '%{ username } wants to follow your library "%{ library }"')
|
||||||
return {
|
return {
|
||||||
libraryFollowMessage,
|
libraryFollowMessage,
|
||||||
libraryAcceptFollowMessage,
|
libraryAcceptFollowMessage,
|
||||||
|
libraryRejectMessage,
|
||||||
libraryPendingFollowMessage,
|
libraryPendingFollowMessage,
|
||||||
markRead: this.$pgettext('Content/Notifications/Button.Tooltip/Verb', 'Mark as read'),
|
markRead: this.$pgettext('Content/Notifications/Button.Tooltip/Verb', 'Mark as read'),
|
||||||
markUnread: this.$pgettext('Content/Notifications/Button.Tooltip/Verb', 'Mark as unread'),
|
markUnread: this.$pgettext('Content/Notifications/Button.Tooltip/Verb', 'Mark as unread'),
|
||||||
|
@ -56,21 +62,31 @@ export default {
|
||||||
let a = this.item.activity
|
let a = this.item.activity
|
||||||
if (a.type === 'Follow') {
|
if (a.type === 'Follow') {
|
||||||
if (a.object && a.object.type === 'music.Library') {
|
if (a.object && a.object.type === 'music.Library') {
|
||||||
let action = null
|
let acceptFollow = null
|
||||||
|
let rejectFollow = null
|
||||||
let message = null
|
let message = null
|
||||||
if (!a.related_object.approved) {
|
if (a.related_object.approved === null) {
|
||||||
message = this.labels.libraryPendingFollowMessage
|
message = this.labels.libraryPendingFollowMessage
|
||||||
action = {
|
acceptFollow = {
|
||||||
buttonClass: 'green',
|
buttonClass: 'green',
|
||||||
icon: 'check',
|
icon: 'check',
|
||||||
label: this.$pgettext('Content/*/Button.Label/Verb', 'Approve'),
|
label: this.$pgettext('Content/*/Button.Label/Verb', 'Approve'),
|
||||||
handler: () => { self.approveLibraryFollow(a.related_object) }
|
handler: () => { self.approveLibraryFollow(a.related_object) }
|
||||||
|
},
|
||||||
|
rejectFollow = {
|
||||||
|
buttonClass: 'red',
|
||||||
|
icon: 'x',
|
||||||
|
label: this.$pgettext('Content/*/Button.Label/Verb', 'Reject'),
|
||||||
|
handler: () => { self.rejectLibraryFollow(a.related_object) }
|
||||||
}
|
}
|
||||||
} else {
|
} else if (a.related_object.approved) {
|
||||||
message = this.labels.libraryFollowMessage
|
message = this.labels.libraryFollowMessage
|
||||||
|
} else {
|
||||||
|
message = this.labels.libraryRejectMessage
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
action,
|
acceptFollow,
|
||||||
|
rejectFollow,
|
||||||
detailUrl: {name: 'content.libraries.detail', params: {id: a.object.uuid}},
|
detailUrl: {name: 'content.libraries.detail', params: {id: a.object.uuid}},
|
||||||
message: this.$gettextInterpolate(
|
message: this.$gettextInterpolate(
|
||||||
message,
|
message,
|
||||||
|
@ -107,6 +123,14 @@ export default {
|
||||||
follow.approved = true
|
follow.approved = true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
rejectLibraryFollow (follow) {
|
||||||
|
let self = this
|
||||||
|
let action = 'reject'
|
||||||
|
axios.post(`federation/follows/library/${follow.uuid}/${action}/`).then((response) => {
|
||||||
|
follow.isLoading = false
|
||||||
|
follow.approved = false
|
||||||
|
})
|
||||||
|
},
|
||||||
markRead (value) {
|
markRead (value) {
|
||||||
let self = this
|
let self = this
|
||||||
let action = 'accept'
|
let action = 'accept'
|
||||||
|
|
Loading…
Reference in New Issue