diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-11-06 00:06:39 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-11-06 00:06:39 +0100 |
commit | f970cef325d94335b13240941c95a12c58f9ccb3 (patch) | |
tree | 3eb2724c83babebb42075937b2fe7ba354ea7228 | |
parent | 80c9459f878ea108fec83a0af6754c5e27e26b23 (diff) |
Do not show duplicate notifications for additional messages sync
-rw-r--r-- | src/plugins/Matrix.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index b99aa02..86dfb3e 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -1301,7 +1301,7 @@ namespace QuickMedia { // TODO: Use /_matrix/client/r0/notifications ? or remove this and always look for displayname/user_id in messages bool has_unread_notifications = false; const rapidjson::Value &unread_notification_json = GetMember(it.value, "unread_notifications"); - if(unread_notification_json.IsObject() && is_initial_sync_finished()) { + if(unread_notification_json.IsObject() && is_initial_sync_finished() && !is_additional_messages_sync) { const rapidjson::Value &highlight_count_json = GetMember(unread_notification_json, "highlight_count"); if(highlight_count_json.IsNumber() && highlight_count_json.GetInt64() > 0) { room->unread_notification_count = highlight_count_json.GetInt64(); @@ -1644,7 +1644,7 @@ namespace QuickMedia { room_data->append_messages(new_messages); } - if(is_initial_sync_finished()) { + if(has_unread_notifications) { time_t read_marker_message_timestamp = 0; if(me) { auto read_marker_message = room_data->get_message_by_id(room_data->get_user_read_marker(me)); @@ -1655,7 +1655,7 @@ namespace QuickMedia { for(auto &message : new_messages) { // TODO: Is @room ok? shouldn't we also check if the user has permission to do @room? (only when notifications are limited to @mentions) // TODO: Is comparing against read marker timestamp ok enough? - if(has_unread_notifications && me && message->timestamp > read_marker_message_timestamp) + if(me && message->timestamp > read_marker_message_timestamp) message->mentions_me = message_contains_user_mention(message->body, me->display_name) || message_contains_user_mention(message->body, me->user_id) || message_contains_user_mention(message->body, "@room"); } } |