summaryrefslogtreecommitdiffstats
path: root/hyperkitty/views/thread.py
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-02-13 18:13:46 +0100
committerAurélien Bompard <aurelien@bompard.org>2013-02-13 18:30:04 +0100
commit02d09d5304823de3439bc0eb701cddbdb66c0d42 (patch)
tree4ee675714d4d2babbef65e4621f278f7a725f3dc /hyperkitty/views/thread.py
parent0e96a34e0d54b06c79750afafc503a3444bcddfd (diff)
downloadhyperkitty-02d09d5304823de3439bc0eb701cddbdb66c0d42.tar.gz
hyperkitty-02d09d5304823de3439bc0eb701cddbdb66c0d42.tar.xz
hyperkitty-02d09d5304823de3439bc0eb701cddbdb66c0d42.zip
Allow cancelling a vote
Diffstat (limited to 'hyperkitty/views/thread.py')
-rw-r--r--hyperkitty/views/thread.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/hyperkitty/views/thread.py b/hyperkitty/views/thread.py
index 8fcca20..a1788cd 100644
--- a/hyperkitty/views/thread.py
+++ b/hyperkitty/views/thread.py
@@ -21,6 +21,7 @@
#
import datetime
+from collections import namedtuple
import django.utils.simplejson as json
@@ -33,7 +34,8 @@ from django.core.exceptions import SuspiciousOperation
from hyperkitty.models import Tag, Favorite
from forms import SearchForm, AddTagForm, ReplyForm
-from hyperkitty.lib import get_months, get_store, stripped_subject, get_votes
+from hyperkitty.lib import get_months, get_store, stripped_subject
+from hyperkitty.lib.voting import set_message_votes
def thread_index(request, mlist_fqdn, threadid, month=None, year=None):
@@ -55,15 +57,7 @@ def thread_index(request, mlist_fqdn, threadid, month=None, year=None):
participants = {}
for email in emails:
# Extract all the votes for this message
- email.likes, email.dislikes = get_votes(email.message_id_hash)
- email.likestatus = "neutral"
- if email.likes - email.dislikes >= 10:
- email.likestatus = "likealot"
- elif email.likes - email.dislikes > 0:
- email.likestatus = "like"
- #elif email.likes - email.dislikes < 0:
- # email.likestatus = "dislike"
-
+ set_message_votes(email, request.user)
# Statistics on how many participants and messages this month
participants[email.sender_name] = email.sender_email
@@ -146,10 +140,11 @@ def add_tag(request, mlist_fqdn, threadid):
# Now refresh the tag list
tags = Tag.objects.filter(threadid=threadid, list_address=mlist_fqdn)
+ FakeMList = namedtuple("MailingList", ["name"])
t = loader.get_template('threads/tags.html')
html = t.render(RequestContext(request, {
"tags": tags,
- "list_address": mlist_fqdn}))
+ "mlist": FakeMList(name=mlist_fqdn)}))
response = {"tags": [ t.tag for t in tags ], "html": html}
return HttpResponse(json.dumps(response),