summaryrefslogtreecommitdiffstats
path: root/hyperkitty/views
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-06-03 20:23:45 +0200
committerAurélien Bompard <aurelien@bompard.org>2013-06-03 20:23:45 +0200
commitfcdaa7f3fd2b830ca566386a1711070407c7f191 (patch)
tree24648e4e8c299addc68d44445c52d4d5cf35fd12 /hyperkitty/views
parent30be2dbbcff4b01869bbb0120eb6679cc4b55cd0 (diff)
downloadhyperkitty-fcdaa7f3fd2b830ca566386a1711070407c7f191.tar.gz
hyperkitty-fcdaa7f3fd2b830ca566386a1711070407c7f191.tar.xz
hyperkitty-fcdaa7f3fd2b830ca566386a1711070407c7f191.zip
Add a navigation bar to skip through unread messages
Diffstat (limited to 'hyperkitty/views')
-rw-r--r--hyperkitty/views/thread.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/hyperkitty/views/thread.py b/hyperkitty/views/thread.py
index 03cfd6a..1e44714 100644
--- a/hyperkitty/views/thread.py
+++ b/hyperkitty/views/thread.py
@@ -118,6 +118,15 @@ def thread_index(request, mlist_fqdn, threadid, month=None, year=None):
if not created:
last_view = last_view_obj.view_date
last_view_obj.save() # update timestamp
+ # get the number of unread messages
+ if last_view is None:
+ if request.user.is_authenticated():
+ unread_count = len(thread)
+ else:
+ unread_count = 0
+ else:
+ # XXX: Storm-specific
+ unread_count = thread.replies_after(last_view).count()
# TODO: eventually move to a middleware ?
# http://djangosnippets.org/snippets/1865/
@@ -145,6 +154,7 @@ def thread_index(request, mlist_fqdn, threadid, month=None, year=None):
'is_bot': is_bot,
'participants': thread.participants,
'last_view': last_view,
+ 'unread_count': unread_count,
}
context["participants"].sort(key=lambda x: x[0].lower())