mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-30 12:42:16 -05:00
sync around Conversation.getLatestMessage()
This commit is contained in:
parent
4d1b6d4404
commit
8de81e0bc8
@ -470,13 +470,15 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Message getLatestMessage() {
|
public Message getLatestMessage() {
|
||||||
if (this.messages.size() == 0) {
|
synchronized (this.messages) {
|
||||||
Message message = new Message(this, "", Message.ENCRYPTION_NONE);
|
if (this.messages.size() == 0) {
|
||||||
message.setType(Message.TYPE_STATUS);
|
Message message = new Message(this, "", Message.ENCRYPTION_NONE);
|
||||||
message.setTime(Math.max(getCreated(),getLastClearHistory().getTimestamp()));
|
message.setType(Message.TYPE_STATUS);
|
||||||
return message;
|
message.setTime(Math.max(getCreated(), getLastClearHistory().getTimestamp()));
|
||||||
} else {
|
return message;
|
||||||
return this.messages.get(this.messages.size() - 1);
|
} else {
|
||||||
|
return this.messages.get(this.messages.size() - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user