Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andy Craze
funkwhale
Commits
c3dc4e2a
Verified
Commit
c3dc4e2a
authored
5 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
Review fixes for report notifications not included in !880
parent
efaeb1bd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/funkwhale_api/moderation/tasks.py
+5
-7
5 additions, 7 deletions
api/funkwhale_api/moderation/tasks.py
api/tests/moderation/test_tasks.py
+3
-0
3 additions, 0 deletions
api/tests/moderation/test_tasks.py
with
8 additions
and
7 deletions
api/funkwhale_api/moderation/tasks.py
+
5
−
7
View file @
c3dc4e2a
...
...
@@ -53,10 +53,11 @@ def send_new_report_email_to_moderators(report):
# we fallback on superusers
moderators
=
users_models
.
User
.
objects
.
filter
(
is_superuser
=
True
)
moderators
=
sorted
(
moderators
,
key
=
lambda
m
:
m
.
pk
)
submitter_repr
=
(
report
.
submitter
.
full_username
if
report
.
submitter
else
report
.
submitter_email
)
subject
=
"
[{} moderation - {}] New report from {}
"
.
format
(
settings
.
FUNKWHALE_HOSTNAME
,
report
.
get_type_display
(),
report
.
submitter
.
full_username
if
report
.
submitter
else
report
.
submitter_email
,
settings
.
FUNKWHALE_HOSTNAME
,
report
.
get_type_display
(),
submitter_repr
)
detail_url
=
federation_utils
.
full_url
(
"
/manage/moderation/reports/{}
"
.
format
(
report
.
uuid
)
...
...
@@ -67,10 +68,7 @@ def send_new_report_email_to_moderators(report):
unresolved_reports
=
models
.
Report
.
objects
.
filter
(
is_handled
=
False
).
count
()
body
=
[
'
{} just submitted a report in the
"
{}
"
category.
'
.
format
(
report
.
submitter
.
full_username
if
report
.
submitter
else
report
.
submitter_email
,
report
.
get_type_display
(),
submitter_repr
,
report
.
get_type_display
()
),
""
,
"
Reported object: {} - {}
"
.
format
(
...
...
This diff is collapsed.
Click to expand it.
api/tests/moderation/test_tasks.py
+
3
−
0
View file @
c3dc4e2a
...
...
@@ -17,6 +17,8 @@ def test_report_created_signal_sends_email_to_mods(factories, mailoutbox, settin
mod2
=
factories
[
"
users.User
"
](
permission_moderation
=
True
)
# inactive, so no email
factories
[
"
users.User
"
](
permission_moderation
=
True
,
is_active
=
False
)
# no moderation permission, so no email
factories
[
"
users.User
"
]()
report
=
factories
[
"
moderation.Report
"
]()
...
...
@@ -28,6 +30,7 @@ def test_report_created_signal_sends_email_to_mods(factories, mailoutbox, settin
unresolved_reports_url
=
federation_utils
.
full_url
(
"
/manage/moderation/reports?q=resolved:no
"
)
assert
len
(
mailoutbox
)
==
2
for
i
,
mod
in
enumerate
([
mod1
,
mod2
]):
m
=
mailoutbox
[
i
]
assert
m
.
subject
==
"
[{} moderation - {}] New report from {}
"
.
format
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment