fix(PinnedMessagesPopup): Fixed reply messages displaying

This commit is contained in:
Igor Sirotin 2022-09-30 17:36:49 +03:00 committed by Igor Sirotin
parent 3e3ad7fef5
commit b65023bf45
6 changed files with 25 additions and 17 deletions

View File

@ -15,7 +15,6 @@ StatusDialog {
property var store
property var messageStore
property var messagesModule
property var pinnedMessagesModel //this doesn't belong to the messageStore, it is a part of the ChatContentStore, but we didn't introduce it yet.
property string messageToPin
property string messageToUnpin
@ -70,12 +69,14 @@ StatusDialog {
messageContextMenu: msgContextMenu
messageId: model.id
responseToMessageWithId: model.responseToMessageWithId
senderId: model.senderId
senderDisplayName: model.senderDisplayName
senderOptionalName: model.senderOptionalName
senderIsEnsVerified: model.senderEnsVerified
senderIsAdded: model.senderIsAdded
senderIcon: model.senderIcon
senderTrustStatus: model.senderTrustStatus
amISender: model.amISender
messageText: model.messageText
messageImage: model.messageImage
@ -84,7 +85,6 @@ StatusDialog {
messageContentType: model.contentType
pinnedMessage: model.pinned
messagePinnedBy: model.pinnedBy
senderTrustStatus: model.senderTrustStatus
linkUrls: model.links
transactionParams: model.transactionParameters
@ -136,11 +136,11 @@ StatusDialog {
}
onUnpinMessage: {
root.messagesModule.unpinMessage(messageId)
root.messageStore.unpinMessage(messageId)
}
onJumpToMessage: {
root.messagesModule.jumpToMessage(messageId)
root.messageStore.messagesModule.jumpToMessage(messageId)
}
}
}

View File

@ -30,17 +30,21 @@ QtObject {
}
function getMessageByIdAsJson (id) {
if(!messageModule)
if (!messageModule) {
console.warn("getMessageByIdAsJson: Failed to parse message, because messageModule is not set")
return false
}
let jsonObj = messageModule.getMessageByIdAsJson(id)
if(jsonObj === "")
return
const jsonObj = messageModule.getMessageByIdAsJson(id)
if (jsonObj === "") {
console.warn("getMessageByIdAsJson: Failed to get message, returned json is empty")
return undefined
}
let obj = JSON.parse(jsonObj)
const obj = JSON.parse(jsonObj)
if (obj.error) {
// This log is available only in debug mode, if it's annoying we can remove it
console.debug("error parsing message for index: ", id, " error: ", obj.error)
console.debug("getMessageByIdAsJson: Failed to parse message for index: ", id, " error: ", obj.error)
return false
}

View File

@ -71,7 +71,7 @@ ColumnLayout {
MessageStore {
id: messageStore
messageModule: chatContentModule? chatContentModule.messagesModule : null
messageModule: chatContentModule ? chatContentModule.messagesModule : null
chatSectionModule: root.rootStore.chatCommunitySectionModule
}
@ -95,7 +95,6 @@ ColumnLayout {
Global.openPopup(Global.pinnedMessagesPopup, {
store: rootStore,
messageStore: messageStore,
messagesModule: chatContentModule.messagesModule,
pinnedMessagesModel: chatContentModule.pinnedMessagesModel,
messageToPin: messageId
})

View File

@ -10,6 +10,7 @@ import StatusQ.Core.Utils 0.1 as SQUtils
import utils 1.0
import "../panels"
import "../stores"
RowLayout {
id: root
@ -35,6 +36,12 @@ RowLayout {
readonly property bool selectingMembers: root.state == stateMembersSelectorContent
}
MessageStore {
id: messageStore
messageModule: chatContentModule ? chatContentModule.messagesModule : null
chatSectionModule: root.rootStore.chatCommunitySectionModule
}
Loader {
id: loader
Layout.fillWidth: d.selectingMembers
@ -216,7 +223,7 @@ RowLayout {
root.state = d.stateMembersSelectorContent
}
onFetchMoreMessages: {
root.rootStore.messageStore.requestMoreMessages();
messageStore.requestMoreMessages();
}
onLeaveGroup: {
chatContentModule.leaveChat();
@ -300,8 +307,7 @@ RowLayout {
}
Global.openPopup(Global.pinnedMessagesPopup, {
store: rootStore,
messageStore: root.rootStore.messageStore,
messagesModule: chatContentModule.messagesModule,
messageStore: messageStore,
pinnedMessagesModel: chatContentModule.pinnedMessagesModel,
messageToPin: ""
})

View File

@ -279,13 +279,13 @@ Item {
senderIsEnsVerified: model.senderEnsVerified
senderIcon: model.senderIcon
senderIsAdded: model.senderIsAdded
senderTrustStatus: model.senderTrustStatus
amISender: model.amISender
messageText: model.messageText
messageImage: model.messageImage
messageTimestamp: model.timestamp
messageOutgoingStatus: model.outgoingStatus
messageContentType: model.contentType
senderTrustStatus: model.senderTrustStatus
pinnedMessage: model.pinned
messagePinnedBy: model.pinnedBy
reactionsModel: model.reactions

View File

@ -767,7 +767,6 @@ Loader {
Global.openPopup(Global.pinnedMessagesPopup, {
store: root.rootStore,
messageStore: messageStore,
messagesModule: chatContentModule.messagesModule,
pinnedMessagesModel: chatContentModule.pinnedMessagesModel,
messageToPin: root.messageId
});