From 16c4e3eec7b5ff6b7895d0643966d832071ee8cd Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 14 Nov 2020 09:55:43 +0100 Subject: [PATCH] keep conversation bold (unread) after responding to a call. fixes #3926 --- .../conversations/entities/Conversation.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index cdd891966..702873fe2 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -550,7 +550,15 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl } public boolean isRead() { - return (this.messages.size() == 0) || this.messages.get(this.messages.size() - 1).isRead(); + synchronized (this.messages) { + for(final Message message : Lists.reverse(this.messages)) { + if (message.isRead() && message.getType() == Message.TYPE_RTP_SESSION) { + continue; + } + return message.isRead(); + } + return true; + } } public List markRead(String upToUuid) { @@ -1010,8 +1018,11 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl public int unreadCount() { synchronized (this.messages) { int count = 0; - for (int i = this.messages.size() - 1; i >= 0; --i) { - if (this.messages.get(i).isRead()) { + for(final Message message : Lists.reverse(this.messages)) { + if (message.isRead()) { + if (message.getType() == Message.TYPE_RTP_SESSION) { + continue; + } return count; } ++count;