-
- {{ notificationData.action.label }}
+
+
+
+ {{ notificationData.acceptFollow.label }}
+
+
+
+ {{ notificationData.rejectFollow.label }}
@@ -38,10 +42,12 @@ export default {
labels () {
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 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 }"')
return {
libraryFollowMessage,
libraryAcceptFollowMessage,
+ libraryRejectMessage,
libraryPendingFollowMessage,
markRead: this.$pgettext('Content/Notifications/Button.Tooltip/Verb', 'Mark as read'),
markUnread: this.$pgettext('Content/Notifications/Button.Tooltip/Verb', 'Mark as unread'),
@@ -56,21 +62,31 @@ export default {
let a = this.item.activity
if (a.type === 'Follow') {
if (a.object && a.object.type === 'music.Library') {
- let action = null
+ let acceptFollow = null
+ let rejectFollow = null
let message = null
- if (!a.related_object.approved) {
+ if (a.related_object.approved === null) {
message = this.labels.libraryPendingFollowMessage
- action = {
+ acceptFollow = {
buttonClass: 'green',
icon: 'check',
label: this.$pgettext('Content/*/Button.Label/Verb', 'Approve'),
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
+ } else {
+ message = this.labels.libraryRejectMessage
}
return {
- action,
+ acceptFollow,
+ rejectFollow,
detailUrl: {name: 'content.libraries.detail', params: {id: a.object.uuid}},
message: this.$gettextInterpolate(
message,
@@ -107,6 +123,14 @@ export default {
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) {
let self = this
let action = 'accept'