Adjust shadowed comment visibility.

- Don't show shadowed comments to non-jannies in notifications.
- Auto-collapse for jannies in notifs/threads.
remotes/1693176582716663532/tmp_refs/heads/watchparty
Snakes 2022-11-13 17:13:14 -05:00
parent 994ca902ca
commit f6dea300b0
Signed by: Snakes
GPG Key ID: E745A82778055C7E
2 changed files with 7 additions and 1 deletions

View File

@ -362,6 +362,8 @@ class Comment(Base):
if self.is_banned: return True
if self.author.shadowbanned and not v.shadowbanned: return True
if (self.wordle_result) and (not self.body or len(self.body_html) <= 100) and 9 > self.level > 1: return True
if v and v.filter_words and self.body and any(x in self.body for x in v.filter_words): return True

View File

@ -270,8 +270,12 @@ def notifications(v):
Comment.body_html.notlike('%<p>New site mention%<a href="https://old.reddit.com/r/%'),
or_(Comment.sentto == None, Comment.sentto == 2),
not_(and_(Comment.sentto == 2, User.is_muted)),
).order_by(Notification.created_utc.desc())
)
if v.admin_level < PERMS['USER_SHADOWBAN']:
comments = comments.filter(User.shadowbanned == None)
comments = comments.order_by(Notification.created_utc.desc())
comments = comments.offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE+1).all()
next_exists = (len(comments) > PAGE_SIZE)