When resolving a repot, reset the 'reports' counter on the comment, post or user #21

This commit is contained in:
rimu 2024-04-06 13:53:41 +13:00
parent 6264a07c49
commit 8cc80fb2e2
3 changed files with 32 additions and 12 deletions

View file

@ -1051,7 +1051,19 @@ def community_moderate_report_resolve(community_id, report_id):
form = ResolveReportForm() form = ResolveReportForm()
if form.validate_on_submit(): if form.validate_on_submit():
report.status = REPORT_STATE_RESOLVED 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() db.session.commit()
# todo: remove unread notifications about this report # todo: remove unread notifications about this report
# todo: append to mod log # todo: append to mod log
if form.also_resolve_others.data: if form.also_resolve_others.data:

View file

@ -49,17 +49,25 @@
<td>{{ report.type_text() }}</td> <td>{{ report.type_text() }}</td>
<td>{{ moment(report.created_at).fromNow() }}</td> <td>{{ moment(report.created_at).fromNow() }}</td>
<td> <td>
<div class="dropdown">
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
Actions
</button>
<ul class="dropdown-menu">
{% if report.suspect_conversation_id %} {% if report.suspect_conversation_id %}
<a href="/chat/{{ report.suspect_conversation_id }}#message">View</a> <li><a class="dropdown-item" href="/chat/{{ report.suspect_conversation_id }}#message">View</a></li>
{% elif report.suspect_post_reply_id %} {% elif report.suspect_post_reply_id %}
<a href="/post/{{ report.suspect_post_id }}#comment_{{ report.suspect_post_reply_id }}">View</a> <li><a class="dropdown-item" href="/post/{{ report.suspect_post_id }}#comment_{{ report.suspect_post_reply_id }}">View</a></li>
{% elif report.suspect_post_id %} {% elif report.suspect_post_id %}
<a href="/post/{{ report.suspect_post_id }}">View</a> <li><a class="dropdown-item" href="/post/{{ report.suspect_post_id }}">View</a></li>
{% elif report.suspect_user_id %} {% elif report.suspect_user_id %}
<a href="/user/{{ report.suspect_user_id }}">View</a> <li><a class="dropdown-item" href="/user/{{ report.suspect_user_id }}">View</a></li>
{% endif %} | {% endif %}
<a href="{{ url_for('community.community_moderate_report_escalate', community_id=community.id, report_id=report.id) }}">{{ _('Escalate') }}</a> | <div class="dropdown-divider"></div>
<a href="{{ url_for('community.community_moderate_report_resolve', community_id=community.id, report_id=report.id) }}">{{ _('Resolve') }}</a> <li><a class="dropdown-item" href="{{ url_for('community.community_moderate_report_escalate', community_id=community.id, report_id=report.id) }}">{{ _('Escalate') }}</a></li>
<li><a class="dropdown-item" href="{{ url_for('community.community_moderate_report_resolve', community_id=community.id, report_id=report.id) }}">{{ _('Resolve') }}</a></li>
</ul>
</div>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: piefed\n" "Project-Id-Version: piefed\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-03-17 19:06+1300\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" "Last-Translator: \n"
"Language: de\n" "Language: de\n"
"Language-Team: German\n" "Language-Team: German\n"