add ability to bookmark posts and threads, courtesy of bitty
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user