fix: chat input preserved properties bugs

This commit is contained in:
Igor Sirotin 2023-06-28 23:19:00 +03:00 committed by Jonathan Rainville
parent 73c0eea487
commit 80fef2179a
3 changed files with 17 additions and 15 deletions

View File

@ -252,14 +252,17 @@ Item {
id: chatInput
width: parent.width
visible: !!d.activeChatContentModule
enabled: !!d.activeChatContentModule
&& !d.activeChatContentModule.chatDetails.blocked
&& root.rootStore.sectionDetails.joined
&& !root.rootStore.sectionDetails.amIBanned
&& root.rootStore.isUserAllowedToSendMessage
&& !channelPostRestrictions.visible
&& root.viewAndPostPermissionsSatisfied
// When `enabled` is switched true->false, `textInput.text` is cleared before d.activeChatContentModule updates.
// We delay the binding so that the `inputAreaModule.preservedProperties.text` doesn't get overriden with empty value.
Binding on enabled {
delayed: true
value: !!d.activeChatContentModule
&& !d.activeChatContentModule.chatDetails.blocked
&& root.rootStore.sectionDetails.joined
&& !root.rootStore.sectionDetails.amIBanned
&& root.rootStore.isUserAllowedToSendMessage
}
store: root.rootStore
usersStore: d.activeUsersStore

View File

@ -371,7 +371,7 @@ Item {
id: sendContactRequestComponent
StatusButton {
anchors.horizontalCenter: parent.horizontalCenter
anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined
text: qsTr("Send Contact Request")
onClicked: {
Global.openContactRequestPopup(root.chatId, null)
@ -383,7 +383,7 @@ Item {
id: acceptOrDeclineContactRequestComponent
RowLayout {
anchors.horizontalCenter: parent.horizontalCenter
anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined
StatusButton {
text: qsTr("Reject Contact Request")
@ -406,7 +406,7 @@ Item {
id: pendingContactRequestComponent
StatusButton {
anchors.horizontalCenter: parent.horizontalCenter
anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined
enabled: false
text: qsTr("Contact Request Pending...")
}

View File

@ -22,6 +22,7 @@ import StatusQ.Controls 0.1 as StatusQ
Rectangle {
id: control
objectName: "statusChatInput"
signal sendTransactionCommandButtonClicked()
signal receiveTransactionCommandButtonClicked()
@ -65,7 +66,6 @@ Rectangle {
Bottom
}
objectName: "statusChatInput"
function parseMessage(message) {
let mentionsMap = new Map()
let index = 0
@ -883,9 +883,8 @@ Rectangle {
}
function resetReplyArea() {
isReply = false;
replyArea.userName = ""
replyArea.message = ""
isReply = false
replyArea.messageId = ""
}
function hideExtendedArea() {