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 @@