forked from rDrama/rDrama
1
0
Fork 0

jannies can now block ppl

master
Aevann1 2022-05-24 22:43:49 +02:00
parent e1f298deb8
commit 9af50ae9b3
3 changed files with 11 additions and 13 deletions

View File

@ -335,7 +335,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
if (sort == "hot" or (v and v.id == Q_ID)) and ccmode == "false" and not gt and not lt:
posts = posts.filter_by(stickied=None)
if v and v.admin_level < 2:
if v:
posts = posts.filter(Submission.author_id.notin_(v.userblocks))
if not (v and v.changelogsub):
@ -384,8 +384,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
if sub: pins = pins.filter_by(sub=sub.name)
elif v:
pins = pins.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks)))
if v.admin_level < 2:
pins = pins.filter(Submission.author_id.notin_(v.userblocks))
pins = pins.filter(Submission.author_id.notin_(v.userblocks))
pins = pins.all()
@ -435,10 +434,9 @@ def changelog(v):
@cache.memoize(timeout=86400)
def changeloglist(v=None, sort="new", page=1, t="all", site=None):
posts = g.db.query(Submission.id).filter_by(is_banned=False, private=False,).filter(Submission.deleted_utc == 0)
posts = g.db.query(Submission.id).filter_by(is_banned=False, private=False, deleted_utc=0)
if v.admin_level < 2:
posts = posts.filter(Submission.author_id.notin_(v.userblocks))
posts = posts.filter(Submission.author_id.notin_(v.userblocks))
admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level > 0).all()]
posts = posts.filter(Submission.title.ilike('_changelog%'), Submission.author_id.in_(admins))
@ -540,12 +538,12 @@ def all_comments(v):
@cache.memoize(timeout=86400)
def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", gt=0, lt=0, site=None):
comments = g.db.query(Comment.id).filter(Comment.parent_submission != None)
comments = g.db.query(Comment.id).filter(Comment.parent_submission != None, Comment.author_id.notin_(v.userblocks))
if v.admin_level < 2:
private = [x[0] for x in g.db.query(Submission.id).filter(Submission.private == True).all()]
comments = comments.filter(Comment.author_id.notin_(v.userblocks), Comment.is_banned==False, Comment.deleted_utc == 0, Comment.parent_submission.notin_(private))
comments = comments.filter(Comment.is_banned==False, Comment.deleted_utc == 0, Comment.parent_submission.notin_(private))
if not v.paid_dues:

View File

@ -55,12 +55,12 @@ def searchposts(v):
posts = g.db.query(Submission.id)
posts = g.db.query(Submission.id).filter(Submission.author_id.notin_(v.userblocks))
if not v.paid_dues: posts = posts.filter_by(club=False)
if v.admin_level < 2:
posts = posts.filter(Submission.deleted_utc == 0, Submission.is_banned == False, Submission.private == False, Submission.author_id.notin_(v.userblocks))
posts = posts.filter(Submission.deleted_utc == 0, Submission.is_banned == False, Submission.private == False)
@ -188,7 +188,7 @@ def searchcomments(v):
criteria = searchparse(query)
comments = g.db.query(Comment.id).filter(Comment.parent_submission != None)
comments = g.db.query(Comment.id).filter(Comment.parent_submission != None, Comment.author_id.notin_(v.userblocks))
if 'author' in criteria:
comments = comments.filter(Comment.ghost == False)
@ -230,7 +230,7 @@ def searchcomments(v):
if v.admin_level < 2:
private = [x[0] for x in g.db.query(Submission.id).filter(Submission.private == True).all()]
comments = comments.filter(Comment.author_id.notin_(v.userblocks), Comment.is_banned==False, Comment.deleted_utc == 0, Comment.parent_submission.notin_(private))
comments = comments.filter(Comment.is_banned==False, Comment.deleted_utc == 0, Comment.parent_submission.notin_(private))
if not v.paid_dues:

View File

@ -60,7 +60,7 @@
{% set replies=c.replies %}
{% endif %}
{% if (c.is_banned or c.deleted_utc or c.is_blocking) and not (v and v.admin_level > 1) and not (v and v.id==c.author_id) %}
{% if c.is_blocking or (c.is_banned or c.deleted_utc) and not (v and v.admin_level > 1) and not (v and v.id==c.author_id) %}
<div id="comment-{{c.id}}" class="comment">
<span class="comment-collapse-desktop d-none d-md-block" style="border-left: 2px solid #{{c.author.namecolor}}"onclick="collapse_comment('{{c.id}}', this.parentElement)"></span>