summaryrefslogtreecommitdiffstats
path: root/hyperkitty/templatetags
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-05-22 13:18:26 +0200
committerAurélien Bompard <aurelien@bompard.org>2013-05-22 16:07:38 +0200
commit1eeef494e6cb6c23f207be8715ff39c0e52e3c37 (patch)
tree2d6c84ca477aa1fd95632dbf73dbd564df6f5f06 /hyperkitty/templatetags
parentcf660d3684d5c839ee9e860c205aa81abf97eb6d (diff)
downloadhyperkitty-1eeef494e6cb6c23f207be8715ff39c0e52e3c37.tar.gz
hyperkitty-1eeef494e6cb6c23f207be8715ff39c0e52e3c37.tar.xz
hyperkitty-1eeef494e6cb6c23f207be8715ff39c0e52e3c37.zip
Track unread threads
And display markers on unread posts in the thread view.
Diffstat (limited to 'hyperkitty/templatetags')
-rw-r--r--hyperkitty/templatetags/hk_generic.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/hyperkitty/templatetags/hk_generic.py b/hyperkitty/templatetags/hk_generic.py
index 1eb2da9..c98c3e2 100644
--- a/hyperkitty/templatetags/hk_generic.py
+++ b/hyperkitty/templatetags/hk_generic.py
@@ -183,3 +183,13 @@ def multiply(num1, num2):
else:
num2 = float(num2)
return num1 * num2
+
+
+def is_message_new(context):
+ user = context["user"]
+ last_view = context.get("last_view")
+ email = context["email"]
+ return (user.is_authenticated() and
+ (last_view is None or email.date > last_view)
+ )
+register.assignment_tag(takes_context=True)(is_message_new)