add unread count to thread title in topic view and thread view

This commit is contained in:
2025-08-17 15:15:06 +03:00
parent 1f80ed7ca5
commit 6dd9f5bf65
5 changed files with 31 additions and 5 deletions

View File

@ -54,12 +54,14 @@ def thread(slug):
other_topics = Topics.select()
is_subscribed = False
unread_count = None
if is_logged_in():
subscription = Subscriptions.find({
'thread_id': thread.id,
'user_id': get_active_user().id,
})
if subscription:
unread_count = subscription.get_unread_count()
if int(posts[-1]['created_at']) > int(subscription.last_seen):
subscription.update({
'last_seen': int(posts[-1]['created_at'])
@ -76,6 +78,7 @@ def thread(slug):
topics = other_topics,
is_subscribed = is_subscribed,
Reactions = Reactions,
unread_count = unread_count,
)