Commit 1b7e6522 authored by Jim Nelson's avatar Jim Nelson

Sort conversations by date received, not sender's date: Closes #6856

Also displays date received in conversation list.
parent 54dc99cf
......@@ -6,10 +6,10 @@
public class ConversationListStore : Gtk.ListStore {
public const Geary.Email.Field REQUIRED_FIELDS =
Geary.Email.Field.ENVELOPE | Geary.Email.Field.FLAGS;
Geary.Email.Field.ENVELOPE | Geary.Email.Field.FLAGS | Geary.Email.Field.PROPERTIES;
public const Geary.Email.Field WITH_PREVIEW_FIELDS =
Geary.Email.Field.ENVELOPE | Geary.Email.Field.FLAGS | Geary.Email.Field.PREVIEW;
Geary.Email.Field.ENVELOPE | Geary.Email.Field.FLAGS | Geary.Email.Field.PROPERTIES | Geary.Email.Field.PREVIEW;
public enum Column {
CONVERSATION_DATA,
......
......@@ -13,7 +13,9 @@ public int compare_conversation_ascending(Geary.Conversation a, Geary.Conversati
else if (b_latest == null)
return 1;
return a_latest.date.value.compare(b_latest.date.value);
// use date-received so newly-arrived messages float to the top, even if they're send date
// was earlier (think of mailing lists that batch up forwarded mail)
return a_latest.properties.date_received.compare(b_latest.properties.date_received);
}
public int compare_conversation_descending(Geary.Conversation a, Geary.Conversation b) {
......
......@@ -102,9 +102,7 @@ public class FormattedConversationData : Geary.BaseObject {
use_to = (folder != null) && folder.special_folder_type.is_outgoing();
// Load preview-related data.
this.date = (preview.date != null)
? Date.pretty_print(preview.date.value, GearyApplication.instance.config.clock_format)
: "";
update_date_string();
this.subject = get_clean_subject_as_string(preview);
this.body = Geary.String.reduce_whitespace(preview.get_preview_as_string());
this.preview = preview;
......@@ -116,15 +114,20 @@ public class FormattedConversationData : Geary.BaseObject {
}
public bool update_date_string() {
if (preview.date == null) {
// get latest email *in folder* for the conversation's date
Geary.Email? latest = conversation.get_latest_email(true);
if (latest == null || latest.properties == null)
return false;
}
string new_date = Date.pretty_print(preview.date.value,
// conversation list store sorts by date-received, so display that instead of sender's
// Date:
string new_date = Date.pretty_print(latest.properties.date_received,
GearyApplication.instance.config.clock_format);
if (new_date == date) {
if (new_date == date)
return false;
}
date = new_date;
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment