diff --git a/files/classes/comment.py b/files/classes/comment.py index e6760c5b5..9ed179da1 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -118,8 +118,8 @@ class Comment(Base): @property @lazy def age_string(self): - if self.created_utc: timestamp = self.created_utc - elif self.notif_utc: timestamp = self.notif_utc + if self.notif_utc: timestamp = self.notif_utc + elif self.created_utc: timestamp = self.created_utc else: return None age = int(time.time()) - timestamp diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 02e90820d..e4426de18 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -9,7 +9,6 @@ def create_comment(text_html, autojanny=False): new_comment = Comment(author_id=author_id, parent_submission=None, - created_utc=0, body_html=text_html) g.db.add(new_comment) g.db.flush() @@ -22,7 +21,7 @@ def send_repeatable_notification(uid, text, autojanny=False): text_html = sanitize(text) - existing_comment = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html, created_utc=0).first() + existing_comment = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html).first() if existing_comment: cid = existing_comment[0] @@ -47,7 +46,7 @@ def notif_comment(text, autojanny=False): text_html = sanitize(text, alert=True) - existing = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html, created_utc=0).one_or_none() + existing = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, body_html=text_html).one_or_none() if existing: return existing[0] else: return create_comment(text_html, autojanny) diff --git a/files/routes/front.py b/files/routes/front.py index 183b46511..a220124d2 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -61,7 +61,7 @@ def notifications(v): x.read = True c.unread = True g.db.add(x) - if not c.created_utc: c.notif_utc = x.created_utc + c.notif_utc = x.created_utc listing.append(c) g.db.commit() @@ -85,7 +85,7 @@ def notifications(v): try: c = comments[i] except: continue if not x.read: c.unread = True - if not c.created_utc: c.notif_utc = x.created_utc + c.notif_utc = x.created_utc x.read = True g.db.add(x) i += 1 @@ -556,7 +556,7 @@ def all_comments(v): @auth_required def transfers(v): - comments = g.db.query(Comment).filter(Comment.author_id == NOTIFICATIONS_ID, Comment.parent_submission == None, Comment.distinguish_level == 6, Comment.body_html.like("% has transferred %"), Comment.created_utc == 0).order_by(Comment.id.desc()) + comments = g.db.query(Comment).filter(Comment.author_id == NOTIFICATIONS_ID, Comment.parent_submission == None, Comment.body_html.like("% has transferred %")).order_by(Comment.id.desc()) if request.headers.get("Authorization"): return {"data": [x.json for x in comments.all()]} diff --git a/files/templates/comments.html b/files/templates/comments.html index 1fc0cfb56..867aaf933 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -231,10 +231,10 @@ {% if c.parent_comment_id and not standalone and level != 1 %}{{c.parent_comment.author_name}}{% endif %} - {% if c.created_utc %} -  {{c.age_string}} - {% elif c.notif_utc %} + {% if c.notif_utc %}  {{c.age_string}} + {% elif c.created_utc %} +  {{c.age_string}} {% endif %} {% if c.edited_utc %}