aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui
diff options
context:
space:
mode:
authorbobufa <bobufa@users.noreply.github.com>2018-08-03 19:41:23 +0200
committerbobufa <bobufa@users.noreply.github.com>2018-08-13 22:39:18 +0200
commitd025387ab95719ebfd7e41676c6f4138bc0afc44 (patch)
tree7505f62314dac49230965a487feb1c6950018590 /main/src/ui
parentec25ecf2024fdd6b0dd70adef9ef644fad3f77f9 (diff)
downloaddino-d025387ab95719ebfd7e41676c6f4138bc0afc44.tar.gz
dino-d025387ab95719ebfd7e41676c6f4138bc0afc44.zip
fix message filter in conversation view for first message
Diffstat (limited to 'main/src/ui')
-rw-r--r--main/src/ui/conversation_summary/conversation_view.vala21
1 files changed, 13 insertions, 8 deletions
diff --git a/main/src/ui/conversation_summary/conversation_view.vala b/main/src/ui/conversation_summary/conversation_view.vala
index f9f0bef0..7fce6673 100644
--- a/main/src/ui/conversation_summary/conversation_view.vala
+++ b/main/src/ui/conversation_summary/conversation_view.vala
@@ -161,13 +161,15 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
}
public void filter_insert_item(Plugins.MetaConversationItem item) {
- print(@"$(meta_items.last().sort_time.compare(item.sort_time))\n");
- print(@"$(meta_items.first().sort_time.compare(item.sort_time))\n");
- if (at_current_content && meta_items.last().sort_time.compare(item.sort_time) < 0) {
- do_insert_item(item);
- } else if (meta_items.last().sort_time.compare(item.sort_time) > 0 && meta_items.first().sort_time.compare(item.sort_time) < 0) {
- do_insert_item(item);
+ if (meta_items.size > 0) {
+ bool after_last = meta_items.last().sort_time.compare(item.sort_time) < 0;
+ bool within_range = meta_items.last().sort_time.compare(item.sort_time) > 0 && meta_items.first().sort_time.compare(item.sort_time) < 0;
+ bool accept = within_range || (at_current_content && after_last);
+ if (!accept) {
+ return;
+ }
}
+ do_insert_item(item);
}
public void do_insert_item(Plugins.MetaConversationItem item) {
@@ -359,8 +361,11 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
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;
+ if (a.seccondary_sort_indicator < b.seccondary_sort_indicator) {
+ res = -1;
+ } else if (a.seccondary_sort_indicator > b.seccondary_sort_indicator) {
+ res = 1;
+ }
}
return res;
}