From 48c21cc0dd3e89e2c9ec8815022f0909eeaa6bb6 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Thu, 25 May 2023 09:22:40 +0300

Subject: [PATCH 1/1] Fixed search with user matches; check user's enabled

notification types

IssueID #70


model.py | 45 ++++++++++++++++++++++++++++++++-------------

1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/model.py b/model.py

index 10caab6..447af76 100644

--- a/model.py

+++ b/model.py

@@ -1074,12 +1074,12 @@ class Database:

         # Notify about the new published post (but not a comment).

         user = self.get_user(id=post.user)

         if not post.parent:

             self.notify_followers(user, post.id,

                                 Notification.POST_IN_FOLLOWED_SUBSPACE,

                                 FOLLOW_SUBSPACE, post.subspace)

         else:

             cur.execute(Database.NUM_CMTS_QUERY, (post.parent, post.parent))

             self.notify_commenters(post)

@@ -1621,6 +1621,20 @@ class Database:

              target_id))

         self.commit()

 def notify_new_poll(self, post: Post):

     cur = self.conn.cursor()

     cur.execute(f"""

@@ -1634,7 +1648,8 @@ class Database:

 def count_notifications(self, user):

     cur = self.conn.cursor()

     for (count,) in cur:

         return count

     return 0

@@ -1699,7 +1714,8 @@ class Database:

     # Notify post author and followers of the closing.

     if add and was_changed and tag == Post.TAG_CLOSED and actor:

         if post.user != actor.id:

                         (Notification.ISSUE_CLOSED, post.user, actor.id, post.id))

         self.notify_followers(actor, post.id, Notification.ISSUE_CLOSED, FOLLOW_POST, post.id)

@@ -1735,8 +1751,8 @@ class Database:

 def get_notifications(self, user, id=None, post_id=None, include_hidden=False, clear=False,

                       sort_desc=False) -> list:

     if id != None:

         cond.append('n.id=?')

         values.append(id)

@@ -1764,13 +1780,16 @@ class Database:

         notifs.append(Notification(id, type, dst, src, post, subspace, is_sent, ts,

                                    src_name, post_title, post_issueid, post_summary,

                                    post_subname, post_subowner, subname))

         cur.execute("""

             DELETE FROM notifs

         self.commit()

     return notifs

@@ -1943,7 +1962,7 @@ class Search:

         for (ts, id, name, avatar, info, url) in cur:

             self.results.append(((exact_match(name), ts),

                                 User(id, name, info, url, avatar, None, None, None,

         # Subspaces.

         cur.execute(f"""

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/bubble/main/patch/48c21cc0dd3e89e2c9ec8815022f0909eeaa6bb6.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
29.103687 milliseconds
Gemini-to-HTML Time
1.528673 milliseconds

This content has been proxied by September (3851b).