diff --git a/src/client/models/conversation-list-store.vala b/src/client/models/conversation-list-store.vala index 684b0ea4..f3b3cf19 100644 --- a/src/client/models/conversation-list-store.vala +++ b/src/client/models/conversation-list-store.vala @@ -245,7 +245,20 @@ public class ConversationListStore : Gtk.ListStore { folder_emails = new Gee.HashSet(); account_emails = new Gee.HashSet(); foreach (Geary.Conversation conversation in sorted_conversations) { - Geary.Email? need_preview = conversation.get_latest_email(); + // find oldest unread message for the preview + Geary.Email? need_preview = null; + foreach (Geary.Email email in conversation.get_emails(Geary.Conversation.Ordering.DATE_ASCENDING)) { + if (email.email_flags.is_unread()) { + need_preview = email; + + break; + } + } + + // if all are read, use newest message + if (need_preview == null) + need_preview = conversation.get_latest_email(); + if (need_preview == null) continue; @@ -455,6 +468,11 @@ public class ConversationListStore : Gtk.ListStore { private void on_email_flags_changed(Geary.Conversation conversation) { refresh_flags(conversation); + + // refresh previews because the oldest unread message is displayed as the preview, and if + // that's changed, need to change the preview + // TODO: need support code to load preview for single conversation, not scan all + refresh_previews_async.begin(conversation_monitor); } private int sort_by_date(Gtk.TreeModel model, Gtk.TreeIter aiter, Gtk.TreeIter biter) {