Skip to content

Commit

Permalink
display per message subjects in thread widget
Browse files Browse the repository at this point in the history
Many senders to not quite grasp the concept of a mail thread, and this
"hijack" a thread by replying and changing the subject. In addition,
there may be good reasons for replies with changed subject, such as an
adjustment of status or the typical patch series threads with individual
topics.

Currently, all this information is hidden in collapsed view but may be
valuable for expanding the right message. Therefore, provide individual
subjects for the messages in thread view.
  • Loading branch information
mjg committed Jan 3, 2021
1 parent 70d7cb6 commit a95aab2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions alot/db/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ def __init__(self, dbman, msg, thread=None):
self._from = '"{}" <{}>'.format(acc.realname, str(acc.address))
else:
self._from = '"Unknown" <>'
try:
self._subject = decode_header(msg.header('Subject'))
except (NullPointerError, LookupError):
self._subject = ''

def __str__(self):
"""prettyprint the message"""
Expand Down Expand Up @@ -132,6 +136,9 @@ def get_message_parts(self):
if not msg.is_multipart():
yield msg

def get_subject(self):
return self._subject

def get_tags(self):
"""returns tags attached to this message as list of strings"""
return sorted(self._tags)
Expand Down
3 changes: 3 additions & 0 deletions alot/widgets/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ def _render_wrap(size, focus=False):
def __str__(self):
author, address = self.message.get_author()
date = self.message.get_datestring()
subject = self.message.get_subject()
rep = author if author != '' else address
if date is not None:
rep += " (%s)" % date
if subject:
rep += ": %s" % subject
return rep

def selectable(self):
Expand Down

0 comments on commit a95aab2

Please sign in to comment.