Fix variable reference in thread API
authorMagnus Hagander <magnus@hagander.net>
Fri, 4 Jan 2019 12:44:16 +0000 (13:44 +0100)
committerMagnus Hagander <magnus@hagander.net>
Fri, 4 Jan 2019 12:44:16 +0000 (13:44 +0100)
This should never have worked, but as the old python version would leak
the last message in the previous loop, it did work. As all messages have
the same threadid (when they're on teh same thread), just us the one in
the known-existing message instead.

django/archives/mailarchives/api.py

index b53e08e9e8f7b7c137cc017cd861adb6ec58a180..c0bced3ac0bc3c0483bebaeaff22e2f11038eb31 100644 (file)
@@ -112,7 +112,7 @@ def thread(request, msgid):
             'atts': [{'id': a.id, 'name': a.filename} for a in m.attachment_set.all()],
         }
         for m in mlist], resp)
-    resp['X-pgthread'] = m.threadid
+    resp['X-pgthread'] = msg.threadid
     return resp