forked from rDrama/rDrama
fix 500 errors
parent
152d39ce6c
commit
0f0a07204c
|
@ -229,7 +229,7 @@ class Comment(Base):
|
|||
elif self.parent_submission: return f"t2_{self.parent_submission}"
|
||||
|
||||
@lazy
|
||||
def replies(self, sort):
|
||||
def replies(self, sort=None):
|
||||
if self.replies2 != None: return [x for x in self.replies2 if not x.author.shadowbanned]
|
||||
if not self.parent_submission:
|
||||
return [x for x in self.child_comments.order_by(Comment.id) if not x.author.shadowbanned]
|
||||
|
@ -340,7 +340,7 @@ class Comment(Base):
|
|||
if self.level>=2: data['parent_comment_id']= self.parent_comment_id
|
||||
|
||||
if "replies" in self.__dict__:
|
||||
data['replies']=[x.json_core for x in self.replies]
|
||||
data['replies']=[x.json_core for x in self.replies(None)]
|
||||
|
||||
return data
|
||||
|
||||
|
|
|
@ -390,7 +390,7 @@ def morecomments(v, cid):
|
|||
comments = output
|
||||
else:
|
||||
c = g.db.get(Comment, cid)
|
||||
comments = c.replies
|
||||
comments = c.replies(None)
|
||||
|
||||
if comments: p = comments[0].post
|
||||
else: p = None
|
||||
|
|
|
@ -755,7 +755,7 @@ def messagereply(v):
|
|||
if not notif:
|
||||
notif = Notification(comment_id=c.id, user_id=user_id)
|
||||
g.db.add(notif)
|
||||
ids = [c.top_comment.id] + [x.id for x in c.top_comment.replies]
|
||||
ids = [c.top_comment.id] + [x.id for x in c.top_comment.replies(None)]
|
||||
notifications = g.db.query(Notification).filter(Notification.comment_id.in_(ids), Notification.user_id == user_id)
|
||||
for n in notifications:
|
||||
g.db.delete(n)
|
||||
|
@ -794,7 +794,7 @@ def messagereply(v):
|
|||
notif = Notification(comment_id=c.id, user_id=admin.id)
|
||||
g.db.add(notif)
|
||||
|
||||
ids = [c.top_comment.id] + [x.id for x in c.top_comment.replies]
|
||||
ids = [c.top_comment.id] + [x.id for x in c.top_comment.replies(None)]
|
||||
uids = [x.id for x in admins]
|
||||
notifications = g.db.query(Notification).filter(Notification.comment_id.in_(ids), Notification.user_id.in_(uids))
|
||||
for n in notifications:
|
||||
|
|
Loading…
Reference in New Issue