summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Yves Chibon <pingou@pingoured.fr>2012-03-18 15:26:38 +0100
committerPierre-Yves Chibon <pingou@pingoured.fr>2012-03-18 15:26:38 +0100
commit4975d6f9319ccd65f5d90a24de9dd5394da0d847 (patch)
tree80ac57ce35cdf9f155508a924a0602338c69b8ca
parent5b0e4f783a405d1532004a47e6cf4984769ebb5e (diff)
downloadhyperkitty-4975d6f9319ccd65f5d90a24de9dd5394da0d847.tar.gz
hyperkitty-4975d6f9319ccd65f5d90a24de9dd5394da0d847.tar.xz
hyperkitty-4975d6f9319ccd65f5d90a24de9dd5394da0d847.zip
Replace Thread-ID by ThreadID so that we can use it in the templates
-rw-r--r--lib/mongo.py12
-rw-r--r--templates/month_view2.html6
-rw-r--r--views/pages.py14
3 files changed, 18 insertions, 14 deletions
diff --git a/lib/mongo.py b/lib/mongo.py
index e429eea..2e971ed 100644
--- a/lib/mongo.py
+++ b/lib/mongo.py
@@ -56,17 +56,17 @@ def get_thread(table, start, end):
def get_thread_length(table, thread_id):
db = connection[table]
- db.mails.create_index('Thread-ID')
- db.mails.ensure_index('Thread-ID')
- return db.mails.find({'Thread-ID': thread_id}).count()
+ db.mails.create_index('ThreadID')
+ db.mails.ensure_index('ThreadID')
+ return db.mails.find({'ThreadID': thread_id}).count()
def get_thread_participants(table, thread_id):
db = connection[table]
- db.mails.create_index('Thread-ID')
- db.mails.ensure_index('Thread-ID')
+ db.mails.create_index('ThreadID')
+ db.mails.ensure_index('ThreadID')
authors = set()
- for mail in db.mails.find({'Thread-ID': thread_id}):
+ for mail in db.mails.find({'ThreadID': thread_id}):
authors.add(mail['From'])
return len(authors)
diff --git a/templates/month_view2.html b/templates/month_view2.html
index e9d5b32..65d646b 100644
--- a/templates/month_view2.html
+++ b/templates/month_view2.html
@@ -23,7 +23,11 @@
<!-- New thread -->
<div class="thread">
<div class="notsaved">
- <span class="thread_title">{{email.Subject}}</span>
+ <span class="thread_title">
+ <a name="{{email.ThreadID}}" href="#{{email.ThreadID}}">
+ {{email.Subject}}
+ </a>
+ </span>
<span class="thread_date"> {{email.Date}}</span>
</div>
<div class="thread_content">
diff --git a/views/pages.py b/views/pages.py
index 75a7e7c..1babd7b 100644
--- a/views/pages.py
+++ b/views/pages.py
@@ -82,9 +82,9 @@ def archives(request, mlist_fqdn, year=None, month=None):
# Statistics on how many participants and threads this month
participants.add(msg['From'])
msg.participants = mongo.get_thread_participants(list_name,
- msg['Thread-ID'])
+ msg['ThreadID'])
msg.answers = mongo.get_thread_length(list_name,
- msg['Thread-ID'])
+ msg['ThreadID'])
threads[cnt] = msg
cnt = cnt + 1
@@ -125,9 +125,9 @@ def list(request, mlist_fqdn=None):
# Statistics on how many participants and threads this month
participants.add(msg['From'])
msg.participants = mongo.get_thread_participants(list_name,
- msg['Thread-ID'])
+ msg['ThreadID'])
msg.answers = mongo.get_thread_length(list_name,
- msg['Thread-ID'])
+ msg['ThreadID'])
threads[cnt] = msg
cnt = cnt + 1
@@ -176,11 +176,11 @@ def _search_results_page(request, mlist_fqdn, query_string, search_type):
msg = Bunch(msg)
# Statistics on how many participants and threads this month
participants.add(msg['From'])
- if 'Thread-ID' in msg:
+ if 'ThreadID' in msg:
msg.participants = mongo.get_thread_participants(list_name,
- msg['Thread-ID'])
+ msg['ThreadID'])
msg.answers = mongo.get_thread_length(list_name,
- msg['Thread-ID'])
+ msg['ThreadID'])
else:
msg.participants = 0
msg.answers = 0