add inbox view
This commit is contained in:
@@ -63,15 +63,7 @@ class Users(Model):
|
||||
return db.query(q, self.id, per_page, (page - 1) * per_page)
|
||||
|
||||
def get_all_subscriptions(self):
|
||||
q = """
|
||||
SELECT threads.title AS thread_title, threads.slug AS thread_slug
|
||||
FROM
|
||||
threads
|
||||
JOIN
|
||||
subscriptions ON subscriptions.thread_id = threads.id
|
||||
WHERE
|
||||
subscriptions.user_id = ?"""
|
||||
return db.query(q, self.id)
|
||||
return Subscriptions.findall({'user_id': self.id})
|
||||
|
||||
def can_post_to_thread_or_topic(self, thread_or_topic):
|
||||
if self.is_guest():
|
||||
@@ -420,6 +412,13 @@ class Subscriptions(Model):
|
||||
return res['unread_count']
|
||||
return None
|
||||
|
||||
def get_thread(self):
|
||||
return Threads.find({'id': self.thread_id})
|
||||
|
||||
def get_full_posts_view(self):
|
||||
q = f'{Posts.FULL_POSTS_QUERY} WHERE posts.thread_id = ? AND posts.created_at > ? ORDER BY posts.created_at ASC'
|
||||
return db.query(q, self.thread_id, self.last_seen)
|
||||
|
||||
class APIRateLimits(Model):
|
||||
table = 'api_rate_limits'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user