diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2013-05-24 11:19:42 +0200 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2013-05-24 11:19:42 +0200 |
commit | d7960dd61479b254506fc7869144ff91f3481e9a (patch) | |
tree | 97bdfe6836f35c02f1538ab71c8d6c67b21767bb /hyperkitty/views | |
parent | d6e6803ebcd75763d243404af5d8c3dfcb2ba8a9 (diff) | |
download | hyperkitty-d7960dd61479b254506fc7869144ff91f3481e9a.tar.gz hyperkitty-d7960dd61479b254506fc7869144ff91f3481e9a.tar.xz hyperkitty-d7960dd61479b254506fc7869144ff91f3481e9a.zip |
Display the number of unread replies
Diffstat (limited to 'hyperkitty/views')
-rw-r--r-- | hyperkitty/views/accounts.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/hyperkitty/views/accounts.py b/hyperkitty/views/accounts.py index b283392..e35b6eb 100644 --- a/hyperkitty/views/accounts.py +++ b/hyperkitty/views/accounts.py @@ -190,7 +190,12 @@ def last_views(request): last_views = last_views_paginator.page(last_views_paginator.num_pages) for last_view in last_views: thread = store.get_thread(last_view.list_address, last_view.threadid) - thread.unread = bool( thread.date_active > last_view.view_date ) + if thread.date_active > last_view.view_date: + # small optimization: only query the replies if necessary + # XXX: Storm-specific (count method) + thread.unread = thread.replies_after(last_view.view_date).count() + else: + thread.unread = 0 last_view.thread = thread return render(request, 'ajax/last_views.html', { |