Rejigger the Mod/Report state system.
This commit is contained in:
parent
31ebdd0213
commit
ccf809406e
36 changed files with 492 additions and 226 deletions
|
@ -3,6 +3,7 @@ from sqlalchemy.orm import Query
|
|||
import files.helpers.listing as listing
|
||||
from files.__main__ import app, limiter
|
||||
from files.classes.submission import Submission
|
||||
from files.classes.visstate import StateMod
|
||||
from files.helpers.comments import comment_filter_moderated
|
||||
from files.helpers.contentsorting import (apply_time_filter,
|
||||
sort_comment_results, sort_objects)
|
||||
|
@ -26,7 +27,7 @@ def unread(v):
|
|||
listing = g.db.query(Notification, Comment).join(Comment, Notification.comment_id == Comment.id).filter(
|
||||
Notification.read == False,
|
||||
Notification.user_id == v.id,
|
||||
Comment.is_banned == False,
|
||||
Comment.state_mod == StateMod.VISIBLE,
|
||||
Comment.state_user_deleted_utc == None,
|
||||
Comment.author_id != AUTOJANNY_ID,
|
||||
).order_by(Notification.created_utc.desc()).all()
|
||||
|
@ -100,7 +101,7 @@ def notifications(v):
|
|||
else:
|
||||
comments = g.db.query(Comment, Notification).join(Notification, Notification.comment_id == Comment.id).filter(
|
||||
Notification.user_id == v.id,
|
||||
Comment.is_banned == False,
|
||||
Comment.state_mod == StateMod.VISIBLE,
|
||||
Comment.state_user_deleted_utc == None,
|
||||
Comment.author_id != AUTOJANNY_ID,
|
||||
Comment.body_html.notlike('%<p>New site mention: <a href="https://old.reddit.com/r/%')
|
||||
|
@ -250,7 +251,7 @@ def changelog(v):
|
|||
|
||||
@app.get("/random_post")
|
||||
def random_post():
|
||||
p = g.db.query(Submission.id).filter(Submission.state_user_deleted_utc == None, Submission.is_banned == False, Submission.private == False).order_by(func.random()).first()
|
||||
p = g.db.query(Submission.id).filter(Submission.state_user_deleted_utc == None, Submission.state_mod == StateMod.VISIBLE, Submission.private == False).order_by(func.random()).first()
|
||||
|
||||
if p: p = p[0]
|
||||
else: abort(404)
|
||||
|
@ -307,11 +308,10 @@ def get_comments_idlist(page=1, v=None, sort="new", t="all", gt=0, lt=0):
|
|||
if v.admin_level < 2:
|
||||
comments = comments.filter(
|
||||
Comment.author_id.notin_(v.userblocks),
|
||||
Comment.is_banned == False,
|
||||
Comment.state_mod == StateMod.VISIBLE,
|
||||
Comment.state_user_deleted_utc == None,
|
||||
Submission.private == False, # comment parent post not private
|
||||
User.shadowbanned == None, # comment author not shadowbanned
|
||||
Comment.filter_state.notin_(('filtered', 'removed')),
|
||||
)
|
||||
|
||||
if gt: comments = comments.filter(Comment.created_utc > gt)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue