Skip to content

Commit

Permalink
db: thread: Fix 'oldest subject' thread names
Browse files Browse the repository at this point in the history
The notmuch2 bindings change now means the retrieval of the oldest
subject from a thread needs to be reworked.

When the config option is chosen to use the oldest subject:
  # Set thread subjects to the first (oldest) message
  thread_subject = oldest

The following error is generated:

    File "/home/kbingham/iob/alot/alot/db/thread.py", line 50, in _refresh
      first_msg = list(thread.get_toplevel_messages())[0]
  AttributeError: 'Thread' object has no attribute 'get_toplevel_messages'

Update the code to use the correct interface on both the Thread and
Message objects.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
  • Loading branch information
kbingham authored and pazz committed Nov 12, 2021
1 parent caf87d9 commit a3b6018
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions alot/db/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def _refresh(self, thread):
subject = thread.subject
elif subject_type == 'oldest':
try:
first_msg = list(thread.get_toplevel_messages())[0]
subject = first_msg.get_header('subject')
first_msg = list(thread.toplevel())[0]
subject = first_msg.header('subject')
except IndexError:
subject = ''
self._subject = subject
Expand Down

0 comments on commit a3b6018

Please sign in to comment.