Files
luk/maildir_gtd/actions/oldest.py
2025-05-08 12:09:43 -06:00

16 lines
587 B
Python

def action_oldest(app) -> None:
"""Show the previous email message by finding the next lower ID from the list of envelope IDs."""
try:
if app.reload_needed:
app.action_fetch_list()
ids = sorted((int(envelope["id"]) for envelope in app.all_envelopes))
app.current_message_id = ids[0]
app.show_message(app.current_message_id)
return
else:
app.show_status("Failed to fetch envelope list.", severity="error")
except Exception as e:
app.show_status(f"Error: {e}", severity="error")