From 97be0072c052b117204ad4dedcb103020f0b3bd4 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 27 Sep 2021 23:50:35 +0200 Subject: [PATCH] fsdfd --- files/classes/comment.py | 1 + files/helpers/alerts.py | 1 + files/routes/posts.py | 2 +- files/templates/comments.html | 8 +++++--- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 6c5931ba2..4408410bc 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -34,6 +34,7 @@ class Comment(Base): is_bot = Column(Boolean, default=False) is_pinned = Column(String(255)) sentto=Column(Integer) + notifiedto=Column(Integer) app_id = Column(Integer, ForeignKey("oauth_apps.id")) oauth_app = relationship("OauthApp", viewonly=True) upvotes = Column(Integer, default=1) diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 6c910c14c..bb326c1ed 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -25,6 +25,7 @@ def send_notification(vid, user, text): distinguish_level=6, body=text, body_html=text_html, + notifiedto=uid ) g.db.add(new_comment) diff --git a/files/routes/posts.py b/files/routes/posts.py index f9809daea..7dd46dfb5 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -354,7 +354,7 @@ def edit_post(pid, v): message = f"@{v.username} has mentioned you: https://{site}{p.permalink}" for x in notify_users: - existing = g.db.query(Comment).options(lazyload('*')).filter(Comment.author_id == NOTIFICATIONS_ACCOUNT, Comment.sentto == x.id, Comment.body == message).first() + existing = g.db.query(Comment).options(lazyload('*')).filter(Comment.author_id == NOTIFICATIONS_ACCOUNT, Comment.sentto == x.id, Comment.body == message, Comment.notifiedto == x.id).first() if not existing: send_notification(NOTIFICATIONS_ACCOUNT, x, message) diff --git a/files/templates/comments.html b/files/templates/comments.html index c7ed71b4f..29fee531c 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -1,4 +1,4 @@ - + --> @@ -202,7 +202,9 @@ {{c.author.username}} {% if c.author.customtitle %}  {% if c.author.quadrant %}{% endif %}{{c.author.customtitle | safe}}{% endif %} - {% if c.parent_comment_id and not standalone and level<=7 %}{{ c.parent_comment.author.username }}{% endif %} + + +  {{c.age_string}} {% if c.edited_utc %}