Refactor chat cache to get remote GXS from GxsIdentityDelegate.qml instead from ChatView

This commit is contained in:
Angela Mazzurco 2017-06-07 15:00:37 +02:00
parent a0f59959a1
commit 7c4ee55fcf
2 changed files with 10 additions and 6 deletions

View file

@ -37,10 +37,6 @@ QtObject {
console.log("updateLastMessage (chatId, chatModel)")
var lastMessage = findChatLastMessage (chatModel)
lastMessageList[chatId].lastMessage = lastMessage
if (!lastMessageList[chatId].remoteGXS) {
var firstMessage = findChatFirstMessage (chatModel)
setRemoteGXS(chatId, firstMessage.author_id)
}
lastMessageChanged(chatId, lastMessage)
}
@ -55,6 +51,10 @@ QtObject {
}
function setRemoteGXS (chatId, remoteGXS){
if (!lastMessageList[chatId]) {
lastMessageList[chatId] = {}
console.log("Last message cache created!")
}
if (lastMessageList[chatId] && !lastMessageList[chatId].remoteGXS){
lastMessageList[chatId].remoteGXS = remoteGXS
return true