Include which lists a message is posted to in flat view
authorMagnus Hagander <magnus@hagander.net>
Wed, 20 Jun 2018 14:28:10 +0000 (16:28 +0200)
committerMagnus Hagander <magnus@hagander.net>
Wed, 20 Jun 2018 14:28:10 +0000 (16:28 +0200)
django/archives/mailarchives/templates/message_flat.html
django/archives/mailarchives/views.py

index 8301982a0d97182a572e0e584eaa9490f7136dea..c72496faff6e520849dc9bc7f6e0f804970eed46 100644 (file)
@@ -17,6 +17,12 @@ window.onload = load;
 {%block contents%}
 {%if not msg.hiddenstatus%}
 <h1 class="subject">{{msg.subject}}</h1>
+<table class="table-sm table-responsive message-header" style="border-bottom: 0.05em solid #E7EAE8; margin-bottom: 1em;">
+ <tr>
+  <th scope="row" style="width: 10%">Lists:</th>
+  <td>{%for l in lists %}<span class="listname"><a href="/list/{{l.listname}}/since/{{msg.shortdate}}">{{l.listname}}</a></span>{%endfor%}</td>
+</table>
+
 {%endif%}
 {%for m in allmsg %}
 <a name="{{m.messageid}}"></a>
index 15adbfcde9c97107aecfad4c17aba75c644ad0a2..098ac5f5b80f15f3d0b21736f7106ae409a92111 100644 (file)
@@ -467,7 +467,7 @@ def message_flat(request, msgid):
        except Message.DoesNotExist:
                raise Http404('Message does not exist')
        allmsg = list(Message.objects.filter(threadid=msg.threadid).order_by('date'))
-       # XXX: need to get the complete list of lists!
+       lists = List.objects.extra(where=["listid IN (SELECT listid FROM list_threads WHERE threadid=%s)" % msg.threadid]).order_by('listname')
 
        isfirst = (msg == allmsg[0])
 
@@ -480,6 +480,7 @@ def message_flat(request, msgid):
        r = render_nav(NavContext(request), 'message_flat.html', {
                        'msg': msg,
                        'allmsg': allmsg,
+                       'lists': lists,
                        'isfirst': isfirst,
                        })
        r['X-pgthread'] = ":%s:" % msg.threadid