Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Georg Abenthung
funkwhale
Commits
8ef8db81
Commit
8ef8db81
authored
Dec 19, 2019
by
Ciarán Ainsworth
Committed by
Eliot Berriot
Dec 19, 2019
Browse files
Resolve "Notifications: not possible to refuse a follow request"
parent
2e86ad40
Changes
2
Hide whitespace changes
Inline
Side-by-side
changes/changelog.d/859.enhancement
0 → 100644
View file @
8ef8db81
Added ability to reject library follows from notifications screen (#859)
\ No newline at end of file
front/src/components/notifications/NotificationRow.vue
View file @
8ef8db81
...
...
@@ -8,10 +8,14 @@
</router-link>
<template
v-else
v-html=
"notificationData.message"
></
template
>
<
template
v-if=
"notificationData.action"
>
<div
@
click=
"handleAction(notificationData.action.handler)"
:class=
"['ui', 'basic', 'tiny', notificationData.action.buttonClass || '', 'button']"
>
<i
v-if=
"notificationData.action.icon"
:class=
"[notificationData.action.icon, 'icon']"
/>
{{
notificationData
.
action
.
label
}}
<
template
v-if=
"notificationData.acceptFollow"
>
<div
@
click=
"handleAction(notificationData.acceptFollow.handler)"
:class=
"['ui', 'basic', 'tiny', notificationData.acceptFollow.buttonClass || '', 'button']"
>
<i
v-if=
"notificationData.acceptFollow.icon"
:class=
"[notificationData.acceptFollow.icon, 'icon']"
/>
{{
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>
</
template
>
</td>
...
...
@@ -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
ac
tion
=
{
ac
ceptFollow
=
{
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
'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment