diff --git a/src/postorius/static/postorius/js/held_messages.js b/src/postorius/static/postorius/js/held_messages.js index ac58805..bc78e12 100644 --- a/src/postorius/static/postorius/js/held_messages.js +++ b/src/postorius/static/postorius/js/held_messages.js @@ -9,7 +9,7 @@ url: rest_url + msgid, success: function(data) { $('#message-source-btn').attr('href', rest_url + msgid + '?raw') - $('#message-title').html(data.msg.subject); + $('#message-title').html(data.subject); $('.modal-footer form input[name="msgid"]').attr('value', msgid); if (data.msg.body) { $('#held-message-content').text(data.msg.body); diff --git a/src/postorius/views/rest.py b/src/postorius/views/rest.py index 2fb4cde..e36f475 100644 --- a/src/postorius/views/rest.py +++ b/src/postorius/views/rest.py @@ -20,7 +20,6 @@ import json -from email.Header import decode_header from email.parser import Parser as EmailParser from email.parser import HeaderParser @@ -37,16 +36,6 @@ def parse(message): msgobj = EmailParser().parsestr(message) header_parser = HeaderParser() - if msgobj['Subject'] is not None: - decodefrag = decode_header(msgobj['Subject']) - subj_fragments = [] - for s, enc in decodefrag: - if enc: - s = unicode(s, enc).encode('utf8', 'replace') - subj_fragments.append(s) - subject = ''.join(subj_fragments) - else: - subject = None headers = [] headers_dict = header_parser.parsestr(message) @@ -54,7 +43,6 @@ headers += ['{}: {}'.format(key, headers_dict[key])] content = Scrubber(msgobj).scrub()[0] return { - 'subject': subject, 'body': content, 'headers': '\n'.join(headers), } @@ -79,6 +67,7 @@ return HttpResponse(held_message.msg, content_type='text/plain') response_data = dict() response_data['sender'] = held_message.sender + response_data['subject'] = held_message.subject response_data['reason'] = held_message.reason response_data['hold_date'] = held_message.hold_date response_data['msg'] = parse(held_message.msg)