From 326e63dab1e65bcf0e2427d9a93b017999c5e11e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi
Date: Mon, 22 May 2023 21:55:54 +0300
Subject: [PATCH 1/1] Follow notifications override regular commenting
model.py | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/model.py b/model.py
index 022eb29..95e9b44 100644
--- a/model.py
+++ b/model.py
@@ -1074,10 +1074,11 @@ class Database:
FOLLOW_POST, parent_post.id)
if parent_post.user != user.id:
# Notify post author of a new comment.
cur.execute("INSERT IGNORE INTO notifs (type, dst, src, post) VALUES (?, ?, ?, ?)",
(Notification.COMMENT, parent_post.user, user.id, parent_post.id))
# Delete redundant lower-priority notifications.
# Delete redundant lower-priority notification going to post author.
cur.execute("DELETE FROM notifs WHERE (type & ?) AND is_hidden=FALSE AND "
"dst=? AND src=? AND post=?",
(Notification.COMMENT_IN_FOLLOWED_SUBSPACE |
@@ -1573,6 +1574,21 @@ class Database:
""")
self.commit()
# Delete redundant notifications.
if follow_type == FOLLOW_POST:
cur.execute(f"""
DELETE FROM notifs
WHERE (type & ?) AND src=? AND post=? AND is_hidden=FALSE AND dst IN (
SELECT user
FROM follow
WHERE type={FOLLOW_POST} AND target={target_id}
)""",
(Notification.COMMENT_ON_COMMENTED |
Notification.COMMENT_BY_FOLLOWED_USER,
actor.id,
target_id))
self.commit()
def notify_new_poll(self, post: Post):
cur = self.conn.cursor()
cur.execute(f"""
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).