keep conversation bold (unread) after responding to a call. fixes #3926

This commit is contained in:
Daniel Gultsch 2020-11-14 09:55:43 +01:00
parent afb2fb1326
commit 16c4e3eec7
1 changed files with 14 additions and 3 deletions

View File

@ -550,7 +550,15 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
} }
public boolean isRead() { 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<Message> markRead(String upToUuid) { public List<Message> markRead(String upToUuid) {
@ -1010,8 +1018,11 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
public int unreadCount() { public int unreadCount() {
synchronized (this.messages) { synchronized (this.messages) {
int count = 0; int count = 0;
for (int i = this.messages.size() - 1; i >= 0; --i) { for(final Message message : Lists.reverse(this.messages)) {
if (this.messages.get(i).isRead()) { if (message.isRead()) {
if (message.getType() == Message.TYPE_RTP_SESSION) {
continue;
}
return count; return count;
} }
++count; ++count;