mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Change how do you put chat tittle saving chat name into variable on cache GXS info
This commit is contained in:
parent
ba72332ed8
commit
ea8d03bc10
@ -51,7 +51,7 @@ QtObject {
|
||||
}
|
||||
|
||||
function setRemoteGXS (chatId, remoteGXS){
|
||||
if (!lastMessageList[chatId]) {
|
||||
if (!lastMessageList[chatId]) {
|
||||
lastMessageList[chatId] = {}
|
||||
console.log("Last message cache created!")
|
||||
}
|
||||
@ -66,13 +66,19 @@ QtObject {
|
||||
|
||||
function getChatIdFromGxs (gxs){
|
||||
for (var key in lastMessageList) {
|
||||
if ( lastMessageList[key].remoteGXS === gxs ) {
|
||||
if ( lastMessageList[key].remoteGXS &&
|
||||
lastMessageList[key].remoteGXS.gxs === gxs ) {
|
||||
return key
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
function getGxsFromChatId (chatId){
|
||||
if (lastMessageList[chatId]) return lastMessageList[chatId].remoteGXS
|
||||
return undefined
|
||||
}
|
||||
|
||||
function getChatLastMessage (chatId){
|
||||
if (lastMessageList[chatId]) {
|
||||
return lastMessageList[chatId].lastMessage
|
||||
|
@ -52,7 +52,12 @@ Item
|
||||
} )
|
||||
}
|
||||
|
||||
Component.onCompleted: refreshData()
|
||||
Component.onCompleted: {
|
||||
refreshData()
|
||||
toolBar.state = "CHATVIEW"
|
||||
var gxs = ChatCache.lastMessageCache.getGxsFromChatId(chatView.chatId)
|
||||
toolBar.titleText = gxs.name
|
||||
}
|
||||
onFocusChanged: focus && refreshData()
|
||||
|
||||
JSONListModel
|
||||
@ -256,6 +261,7 @@ Item
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ Item
|
||||
{'action': 'refreshUnread', 'response': par.response})
|
||||
json.data.forEach (function (chat){
|
||||
ChatCache.lastMessageCache.updateLastMessageCache(chat.chat_id)
|
||||
ChatCache.lastMessageCache.setRemoteGXS (chat.chat_id, chat.remote_author_id)
|
||||
ChatCache.lastMessageCache.setRemoteGXS (chat.chat_id, { gxs: chat.remote_author_id, name: chat.remote_author_name})
|
||||
})
|
||||
}
|
||||
function refreshUnread()
|
||||
|
@ -258,7 +258,7 @@ Item
|
||||
}
|
||||
function startDistantChatCB (par){
|
||||
var chId = JSON.parse(par.response).data.chat_id
|
||||
ChatCache.lastMessageCache.setRemoteGXS(chId, model.gxs_id)
|
||||
ChatCache.lastMessageCache.setRemoteGXS(chId, { gxs: model.gxs_id, name: model.name})
|
||||
contactsView.startChatCallback (par)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user