diff --git a/files/classes/submission.py b/files/classes/submission.py index dd718539f..09db9f4c8 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -66,6 +66,11 @@ class Submission(Base): def __repr__(self): return f"" + @property + @lazy + def comments(self): + return g.db.query(Comment.author_id, Comment.created_utc, Comment.id).filter_by(parent_submission=self.id) + @property @lazy def controversial(self): diff --git a/files/classes/user.py b/files/classes/user.py index 7291aab06..ff0537936 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -559,7 +559,7 @@ class User(Base): @property @lazy def applications(self): - return g.db.query(OauthApp).filter_by(author_id=self.id).order_by(OauthApp.id.asc()).all() + return g.db.query(OauthApp).filter_by(author_id=self.id).order_by(OauthApp.id) @lazy def subscribed_idlist(self, page=1): diff --git a/files/templates/comments.html b/files/templates/comments.html index efa09c8d5..bf1a77c0d 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -861,9 +861,9 @@ redhtml = '' if (lastCount) { - {% for c in comments %} - {% if not (v and v.id==c.author_id) %} - if ({{c.created_utc*1000}} > lastCount.t) document.getElementById("reddot-{{c.id}}").innerHTML = redhtml + {% for c in p.comments %} + {% if not (v and v.id==c[0]) %} + if ({{c[1]*1000}} > lastCount.t) document.getElementById("reddot-{{c[2]}}").innerHTML = redhtml {% endif %} {% endfor %} }