Add page for filtered comments
This commit is contained in:
parent
4ecb4747c1
commit
4b0c4fcc73
4 changed files with 61 additions and 3 deletions
|
@ -450,7 +450,7 @@ def shadowbanned(v):
|
|||
users = [x for x in g.db.query(User).filter(User.shadowbanned != None).order_by(User.shadowbanned).all()]
|
||||
return render_template("shadowbanned.html", v=v, users=users)
|
||||
|
||||
@app.get("/admin/filtered_submissions")
|
||||
@app.get("/admin/filtered/posts")
|
||||
@admin_level_required(2)
|
||||
def filtered_submissions(v):
|
||||
try: page = int(request.values.get('page', 1))
|
||||
|
@ -469,6 +469,25 @@ def filtered_submissions(v):
|
|||
|
||||
return render_template("admin/filtered_submissions.html", v=v, listing=posts, next_exists=next_exists, page=page, sort="new")
|
||||
|
||||
@app.get("/admin/filtered/comments")
|
||||
@admin_level_required(2)
|
||||
def filtered_comments(v):
|
||||
try: page = int(request.values.get('page', 1))
|
||||
except: page = 1
|
||||
|
||||
comments_just_ids = g.db.query(Comment) \
|
||||
.order_by(Comment.id.desc()) \
|
||||
.filter(Comment.filter_state == 'filtered') \
|
||||
.limit(26) \
|
||||
.offset(25 * (page - 1)) \
|
||||
.with_entities(Comment.id)
|
||||
|
||||
comment_ids = [x.id for x in comments_just_ids]
|
||||
next_exists = (len(comment_ids) > 25)
|
||||
comments = get_comments(comment_ids[:25], v=v)
|
||||
|
||||
return render_template("admin/filtered_comments.html", v=v, listing=comments, next_exists=next_exists, page=page, sort="new")
|
||||
|
||||
@app.post("/admin/update_filter_status")
|
||||
@admin_level_required(2)
|
||||
def update_filter_status(v):
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
<h4>Filtering</h4>
|
||||
<ul>
|
||||
<li><a href="/admin/filtered_submissions">Filtered Submissions</a></li>
|
||||
<li><a href="/admin/filtered/posts">Filtered Posts/Comments</a></li>
|
||||
</ul>
|
||||
|
||||
<h4>Users</h4>
|
||||
|
|
26
files/templates/admin/filtered_comments.html
Normal file
26
files/templates/admin/filtered_comments.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
{% extends "admin/filtered_submissions.html" %}
|
||||
|
||||
{% block title %}
|
||||
<title>Filtered Comments</title>
|
||||
{% endblock %}
|
||||
|
||||
{% block listing %}
|
||||
|
||||
|
||||
<div class="posts">
|
||||
{% with comments=listing %}
|
||||
{% include "comments.html" %}
|
||||
{% endwith %}
|
||||
{% if not listing %}
|
||||
<div class="row no-gutters">
|
||||
<div class="col">
|
||||
<div class="text-center py-7">
|
||||
<div class="h4 p-2">There are no comments here (yet).</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -14,13 +14,26 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block title %}
|
||||
<title>Filtered Submissions</title>
|
||||
<title>Filtered Posts</title>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
<ul class="nav post-nav py-2">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.path=="/admin/filtered/posts" %} active{% endif %}" href="/admin/filtered/posts">
|
||||
<div>Posts</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.path=="/admin/filtered/comments" %} active{% endif %}" href="/admin/filtered/comments">
|
||||
<div>Comments</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="row no-gutters">
|
||||
|
||||
<div class="col">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue