diff options
author | fiaxh <git@lightrise.org> | 2018-12-10 18:27:02 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2018-12-27 13:00:45 +0100 |
commit | d0d68f5878267320eb99ad544e9117553af11532 (patch) | |
tree | 16ae5df53541a09441b932a6078d0b3532698094 /main/src/ui/conversation_summary | |
parent | 680d28360c781ff29e810821801cfaba0493c526 (diff) | |
download | dino-d0d68f5878267320eb99ad544e9117553af11532.tar.gz dino-d0d68f5878267320eb99ad544e9117553af11532.zip |
(Partially) Fix messages being displayed wrongly sorted in ConversationSummary due to being compared->equal
Diffstat (limited to 'main/src/ui/conversation_summary')
-rw-r--r-- | main/src/ui/conversation_summary/content_populator.vala | 3 | ||||
-rw-r--r-- | main/src/ui/conversation_summary/conversation_view.vala | 14 |
2 files changed, 9 insertions, 8 deletions
diff --git a/main/src/ui/conversation_summary/content_populator.vala b/main/src/ui/conversation_summary/content_populator.vala index 754446d3..cc014a04 100644 --- a/main/src/ui/conversation_summary/content_populator.vala +++ b/main/src/ui/conversation_summary/content_populator.vala @@ -78,7 +78,8 @@ public class ContentMetaItem : Plugins.MetaConversationItem { public ContentMetaItem(ContentItem content_item, ContentItemWidgetFactory widget_factory) { this.jid = content_item.jid; this.sort_time = content_item.sort_time; - this.seccondary_sort_indicator = content_item.id; + this.seccondary_sort_indicator = (long) content_item.display_time.to_unix(); + this.tertiary_sort_indicator = content_item.id; this.display_time = content_item.display_time; this.encryption = content_item.encryption; this.mark = content_item.mark; diff --git a/main/src/ui/conversation_summary/conversation_view.vala b/main/src/ui/conversation_summary/conversation_view.vala index 83da81aa..0216e891 100644 --- a/main/src/ui/conversation_summary/conversation_view.vala +++ b/main/src/ui/conversation_summary/conversation_view.vala @@ -381,15 +381,15 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins } private static int compare_meta_items(Plugins.MetaConversationItem a, Plugins.MetaConversationItem b) { - int res = a.sort_time.compare(b.sort_time); - if (res == 0) { - if (a.seccondary_sort_indicator < b.seccondary_sort_indicator) { - res = -1; - } else if (a.seccondary_sort_indicator > b.seccondary_sort_indicator) { - res = 1; + int cmp1 = a.sort_time.compare(b.sort_time); + if (cmp1 == 0) { + double cmp2 = a.seccondary_sort_indicator - b.seccondary_sort_indicator; + if (cmp2 == 0) { + return (int) (a.tertiary_sort_indicator - b.tertiary_sort_indicator); } + return (int) cmp2; } - return res; + return cmp1; } private void clear() { |