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 store
property var messageStore 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 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 messageToPin
property string messageToUnpin property string messageToUnpin
@ -70,12 +69,14 @@ StatusDialog {
messageContextMenu: msgContextMenu messageContextMenu: msgContextMenu
messageId: model.id messageId: model.id
responseToMessageWithId: model.responseToMessageWithId
senderId: model.senderId senderId: model.senderId
senderDisplayName: model.senderDisplayName senderDisplayName: model.senderDisplayName
senderOptionalName: model.senderOptionalName senderOptionalName: model.senderOptionalName
senderIsEnsVerified: model.senderEnsVerified senderIsEnsVerified: model.senderEnsVerified
senderIsAdded: model.senderIsAdded senderIsAdded: model.senderIsAdded
senderIcon: model.senderIcon senderIcon: model.senderIcon
senderTrustStatus: model.senderTrustStatus
amISender: model.amISender amISender: model.amISender
messageText: model.messageText messageText: model.messageText
messageImage: model.messageImage messageImage: model.messageImage
@ -84,7 +85,6 @@ StatusDialog {
messageContentType: model.contentType messageContentType: model.contentType
pinnedMessage: model.pinned pinnedMessage: model.pinned
messagePinnedBy: model.pinnedBy messagePinnedBy: model.pinnedBy
senderTrustStatus: model.senderTrustStatus
linkUrls: model.links linkUrls: model.links
transactionParams: model.transactionParameters transactionParams: model.transactionParameters
@ -136,11 +136,11 @@ StatusDialog {
} }
onUnpinMessage: { onUnpinMessage: {
root.messagesModule.unpinMessage(messageId) root.messageStore.unpinMessage(messageId)
} }
onJumpToMessage: { onJumpToMessage: {
root.messagesModule.jumpToMessage(messageId) root.messageStore.messagesModule.jumpToMessage(messageId)
} }
} }
} }

View File

@ -30,17 +30,21 @@ QtObject {
} }
function getMessageByIdAsJson (id) { function getMessageByIdAsJson (id) {
if(!messageModule) if (!messageModule) {
console.warn("getMessageByIdAsJson: Failed to parse message, because messageModule is not set")
return false return false
}
let jsonObj = messageModule.getMessageByIdAsJson(id) const jsonObj = messageModule.getMessageByIdAsJson(id)
if(jsonObj === "") if (jsonObj === "") {
return 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) { if (obj.error) {
// This log is available only in debug mode, if it's annoying we can remove it // 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 return false
} }

View File

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

View File

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

View File

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

View File

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