hide deleted posts and comments from userpages (frequently requested)

master
Aevann1 2022-06-19 01:55:45 +02:00
parent 193615a441
commit f1f30635b2
3 changed files with 10 additions and 2 deletions

View File

@ -299,7 +299,10 @@ class User(Base):
posts = g.db.query(Submission.id).filter_by(author_id=self.id, is_pinned=False)
if not (v and (v.admin_level > 1 or v.id == self.id)):
posts = posts.filter_by(deleted_utc=0, is_banned=False, private=False, ghost=False)
posts = posts.filter_by(is_banned=False, private=False, ghost=False)
if not (v and v.admin_level > 1):
posts = posts.filter_by(deleted_utc=0)
now = int(time.time())
if t == 'hour':

View File

@ -1298,6 +1298,7 @@ def delete_post_pid(pid, v):
g.db.add(post)
cache.delete_memoized(frontlist)
cache.delete_memoized(User.userpagelisting)
g.db.commit()
@ -1314,6 +1315,7 @@ def undelete_post_pid(pid, v):
g.db.add(post)
cache.delete_memoized(frontlist)
cache.delete_memoized(User.userpagelisting)
g.db.commit()

View File

@ -1021,7 +1021,10 @@ def u_username_comments(username, v=None):
comments = g.db.query(Comment.id).filter(Comment.author_id == u.id, Comment.parent_submission != None)
if not v or (v.id != u.id and v.admin_level < 2):
comments = comments.filter(Comment.deleted_utc == 0, Comment.is_banned == False, Comment.ghost == False)
comments = comments.filter(Comment.is_banned == False, Comment.ghost == False)
if not (v and v.admin_level > 1):
comments = comments.filter_by(deleted_utc=0)
now = int(time.time())
if t == 'hour':