From 8cc80fb2e23c1942490b0591cbe7c2646c0f32d8 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sat, 6 Apr 2024 13:53:41 +1300 Subject: [PATCH] When resolving a repot, reset the 'reports' counter on the comment, post or user #21 --- app/community/routes.py | 12 ++++++++ .../community/community_moderate.html | 30 ++++++++++++------- app/translations/de/LC_MESSAGES/messages.po | 2 +- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/app/community/routes.py b/app/community/routes.py index b32e987d..b28b6452 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -1051,7 +1051,19 @@ def community_moderate_report_resolve(community_id, report_id): form = ResolveReportForm() if form.validate_on_submit(): report.status = REPORT_STATE_RESOLVED + + # Reset the 'reports' counter on the comment, post or user + if report.suspect_post_reply_id: + post_reply = PostReply.query.get(report.suspect_post_reply_id) + post_reply.reports = 0 + elif report.suspect_post_id: + post = Post.query.get(report.suspect_post_id) + post.reports = 0 + elif report.suspect_user_id: + user = User.query.get(report.suspect_user_id) + user.reports = 0 db.session.commit() + # todo: remove unread notifications about this report # todo: append to mod log if form.also_resolve_others.data: diff --git a/app/templates/community/community_moderate.html b/app/templates/community/community_moderate.html index e0d88e4a..0e2db665 100644 --- a/app/templates/community/community_moderate.html +++ b/app/templates/community/community_moderate.html @@ -49,17 +49,25 @@ {{ report.type_text() }} {{ moment(report.created_at).fromNow() }} - {% if report.suspect_conversation_id %} - View - {% elif report.suspect_post_reply_id %} - View - {% elif report.suspect_post_id %} - View - {% elif report.suspect_user_id %} - View - {% endif %} | - {{ _('Escalate') }} | - {{ _('Resolve') }} + {% endfor %} diff --git a/app/translations/de/LC_MESSAGES/messages.po b/app/translations/de/LC_MESSAGES/messages.po index 7df5256a..2161a116 100644 --- a/app/translations/de/LC_MESSAGES/messages.po +++ b/app/translations/de/LC_MESSAGES/messages.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: piefed\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "POT-Creation-Date: 2024-03-17 19:06+1300\n" -"PO-Revision-Date: 2024-04-03 21:35\n" +"PO-Revision-Date: 2024-04-04 20:09\n" "Last-Translator: \n" "Language: de\n" "Language-Team: German\n"