code cleanup and synchronized getMarkableMessage()
This commit is contained in:
parent
995d975127
commit
d8d1c1192f
|
@ -456,15 +456,13 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
}
|
}
|
||||||
|
|
||||||
public Message getLatestMarkableMessage() {
|
public Message getLatestMarkableMessage() {
|
||||||
for (int i = this.messages.size() - 1; i >= 0; --i) {
|
synchronized (this.messages) {
|
||||||
if (this.messages.get(i).getStatus() <= Message.STATUS_RECEIVED
|
for (int i = this.messages.size() - 1; i >= 0; --i) {
|
||||||
&& this.messages.get(i).markable) {
|
final Message message = this.messages.get(i);
|
||||||
if (this.messages.get(i).isRead()) {
|
if (message.getStatus() <= Message.STATUS_RECEIVED && message.markable) {
|
||||||
return null;
|
return message.isRead() ? null : message;
|
||||||
} else {
|
|
||||||
return this.messages.get(i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue