forked from MarseyWorld/MarseyWorld
Merge branch 'master' of https://github.com/Aevann1/Drama
commit
aecba85c98
|
@ -59,4 +59,25 @@ def api_flag_comment(cid, v):
|
|||
|
||||
g.db.add(flag)
|
||||
|
||||
return "", 204
|
||||
return "", 204
|
||||
|
||||
|
||||
@app.post('/del_report/<report_fn>')
|
||||
@auth_required
|
||||
@validate_formkey
|
||||
def remove_report(report_fn, v):
|
||||
|
||||
if v.admin_level < 6:
|
||||
return {"error": "go outside"}, 403
|
||||
|
||||
if report_fn.startswith('c'):
|
||||
report = g.db.query(CommentFlag).filter_by(id=int(report_fn.lstrip('c'))).first()
|
||||
elif report_fn.startswith('p'):
|
||||
report = g.db.query(Flag).filter_by(id=int(report_fn.lstrip('p'))).first()
|
||||
else:
|
||||
return {"error": "Invalid report ID"}, 400
|
||||
|
||||
_response = f"Removed @{report.user.username}'s report"
|
||||
g.db.delete(report)
|
||||
|
||||
return {"message": _response}, 200
|
|
@ -152,7 +152,7 @@
|
|||
<pre></pre>
|
||||
<ul style="padding-left:20px; margin-bottom: 0;">
|
||||
{% for f in c.ordered_flags %}
|
||||
<li><a style="font-weight:bold" href="{{f.user.url}}">{{f.user.username}}</a>{% if f.reason %}: {{f.reason | safe}}{% endif %}</li>
|
||||
<li><a style="font-weight:bold" href="{{f.user.url}}">{{f.user.username}}</a>{% if f.reason %}: {{f.reason | safe}}{% endif %} {% if v.admin_level==6 %}<a href="javascript:void(0)" onclick="post_toast('/del_report/c{{ f.id }}')">[remove]</a>{% endif %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -275,7 +275,7 @@
|
|||
<pre></pre>
|
||||
<ul style="padding-left:20px; margin-bottom: 0;">
|
||||
{% for f in p.ordered_flags %}
|
||||
<li><a style="font-weight:bold" href="{{f.user.url}}">{{f.user.username}}</a>{% if f.reason %}: {{f.reason | safe}}{% endif %}</li>
|
||||
<li><a style="font-weight:bold" href="{{f.user.url}}">{{f.user.username}}</a>{% if f.reason %}: {{f.reason | safe}}{% endif %} {% if v.admin_level==6 %}<a href="javascript:void(0)" onclick="post_toast('/del_report/p{{ f.id }}')">[remove]</a>{% endif %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -382,7 +382,7 @@
|
|||
<pre></pre>
|
||||
<ul style="padding-left:20px; margin-bottom: 0;">
|
||||
{% for f in p.ordered_flags %}
|
||||
<li><a style="font-weight:bold" href="{{f.user.url}}">{{f.user.username}}</a>{% if f.reason %}: {{f.reason | safe}}{% endif %}</li>
|
||||
<li><a style="font-weight:bold" href="{{f.user.url}}">{{f.user.username}}</a>{% if f.reason %}: {{f.reason | safe}}{% endif %} {% if v.admin_level==6 %}<a href="javascript:void(0)" onclick="post_toast('/del_report/p{{ f.id }}')">[remove]</a>{% endif %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue