remove jc insanity

pull/138/head
Aevann 2023-03-06 00:50:06 +02:00
parent 4551f94aa6
commit 0c91650a1d
3 changed files with 7 additions and 6 deletions

View File

@ -86,9 +86,10 @@ class Comment(Base):
def __repr__(self):
return f"<{self.__class__.__name__}(id={self.id})>"
@property
@lazy
def top_comment(self, db:scoped_session):
return db.get(Comment, self.top_comment_id)
def top_comment(self):
return g.db.get(Comment, self.top_comment_id)
@property
@lazy

View File

@ -153,9 +153,9 @@ def post_id(pid, anything=None, v=None, sub=None):
pin.stickied_utc = None
g.db.add(pin)
elif pin.level > 1:
pinned2[pin.top_comment(g.db)] = ''
if pin.top_comment(g.db) in comments:
comments.remove(pin.top_comment(g.db))
pinned2[pin.top_comment] = ''
if pin.top_comment in comments:
comments.remove(pin.top_comment)
else:
pinned2[pin] = ''

View File

@ -623,7 +623,7 @@ def messagereply(v:User):
push_notif({user_id}, title, body, url)
top_comment = c.top_comment(g.db)
top_comment = c.top_comment
if top_comment.sentto == MODMAIL_ID:
admins = g.db.query(User.id).filter(User.admin_level >= PERMS['NOTIFICATIONS_MODMAIL'], User.id != v.id)