add ability to bookmark posts and threads, courtesy of bitty

This commit is contained in:
2025-11-23 22:07:50 +03:00
parent 962b833a80
commit 075a9bd498
15 changed files with 521 additions and 31 deletions

View File

@@ -371,6 +371,16 @@ class BookmarkCollections(Model):
res = db.fetch_one(q, self.id)
return int(res['pc'])
def has_thread(self, thread_id):
q = 'SELECT EXISTS(SELECT 1 FROM bookmarked_threads WHERE collection_id = ? AND thread_id = ?) as e'
res = db.fetch_one(q, self.id, int(thread_id))['e']
return int(res) == 1
def has_post(self, post_id):
q = 'SELECT EXISTS(SELECT 1 FROM bookmarked_posts WHERE collection_id = ? AND post_id = ?) as e'
res = db.fetch_one(q, self.id, int(post_id))['e']
return int(res) == 1
class BookmarkedPosts(Model):
table = 'bookmarked_posts'