kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Review fixes for report notifications not included in !880
rodzic
efaeb1bd81
commit
c3dc4e2ab4
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
Ładowanie…
Reference in New Issue