Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f788ddd

Browse files
committedFeb 10, 2021
display per message subjects in thread widget
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.
1 parent 486df70 commit f788ddd

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
 

‎alot/db/message.py

+7
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ def __init__(self, dbman, msg, thread=None):
6868
self._from = '"{}" <{}>'.format(acc.realname, str(acc.address))
6969
else:
7070
self._from = '"Unknown" <>'
71+
try:
72+
self._subject = decode_header(msg.header('Subject'))
73+
except (NullPointerError, LookupError):
74+
self._subject = ''
7175

7276
def __str__(self):
7377
"""prettyprint the message"""
@@ -132,6 +136,9 @@ def get_message_parts(self):
132136
if not msg.is_multipart():
133137
yield msg
134138

139+
def get_subject(self):
140+
return self._subject
141+
135142
def get_tags(self):
136143
"""returns tags attached to this message as list of strings"""
137144
return sorted(self._tags)

‎alot/widgets/thread.py

+3
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ def _render_wrap(size, focus=False):
7878
def __str__(self):
7979
author, address = self.message.get_author()
8080
date = self.message.get_datestring()
81+
subject = self.message.get_subject()
8182
rep = author if author != '' else address
8283
if date is not None:
8384
rep += " (%s)" % date
85+
if subject:
86+
rep += ": %s" % subject
8487
return rep
8588

8689
def selectable(self):

0 commit comments

Comments
 (0)
Please sign in to comment.