fix(ChatColumnView): hide input when no active chat (#11107)

This commit is contained in:
Igor Sirotin 2023-06-15 16:58:32 +03:00 committed by GitHub
parent d534bf6773
commit 407179cd10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 12 deletions

View File

@ -239,8 +239,10 @@ Item {
id: chatInput id: chatInput
Layout.fillWidth: true Layout.fillWidth: true
visible: !!d.activeChatContentModule
enabled: !d.activeChatContentModule.chatDetails.blocked enabled: !!d.activeChatContentModule
&& !d.activeChatContentModule.chatDetails.blocked
&& root.rootStore.sectionDetails.joined && root.rootStore.sectionDetails.joined
&& !root.rootStore.sectionDetails.amIBanned && !root.rootStore.sectionDetails.amIBanned
&& root.rootStore.isUserAllowedToSendMessage && root.rootStore.isUserAllowedToSendMessage
@ -249,6 +251,8 @@ Item {
usersStore: d.activeUsersStore usersStore: d.activeUsersStore
textInput.placeholderText: { textInput.placeholderText: {
if (!d.activeChatContentModule)
return
if (d.activeChatContentModule.chatDetails.blocked) if (d.activeChatContentModule.chatDetails.blocked)
return qsTr("This user has been blocked.") return qsTr("This user has been blocked.")
if (!root.rootStore.sectionDetails.joined || root.rootStore.sectionDetails.amIBanned) if (!root.rootStore.sectionDetails.joined || root.rootStore.sectionDetails.amIBanned)
@ -262,15 +266,18 @@ Item {
suggestions.suggestionFilter.addSystemSuggestions: chatType === Constants.chatType.communityChat suggestions.suggestionFilter.addSystemSuggestions: chatType === Constants.chatType.communityChat
textInput.onTextChanged: { textInput.onTextChanged: {
d.activeChatContentModule.inputAreaModule.preservedProperties.text = textInput.text if (!!d.activeChatContentModule)
d.activeChatContentModule.inputAreaModule.preservedProperties.text = textInput.text
} }
onReplyMessageIdChanged: { onReplyMessageIdChanged: {
d.activeChatContentModule.inputAreaModule.preservedProperties.replyMessageId = replyMessageId if (!!d.activeChatContentModule)
d.activeChatContentModule.inputAreaModule.preservedProperties.replyMessageId = replyMessageId
} }
onFileUrlsAndSourcesChanged: { onFileUrlsAndSourcesChanged: {
d.activeChatContentModule.inputAreaModule.preservedProperties.fileUrlsAndSourcesJson = JSON.stringify(chatInput.fileUrlsAndSources) if (!!d.activeChatContentModule)
d.activeChatContentModule.inputAreaModule.preservedProperties.fileUrlsAndSourcesJson = JSON.stringify(chatInput.fileUrlsAndSources)
} }
onSendTransactionCommandButtonClicked: { onSendTransactionCommandButtonClicked: {
@ -291,7 +298,8 @@ Item {
} }
onStickerSelected: { onStickerSelected: {
root.rootStore.sendSticker(d.activeChatContentModule.getMyChatId(), if (!!d.activeChatContentModule)
root.rootStore.sendSticker(d.activeChatContentModule.getMyChatId(),
hashId, hashId,
chatInput.isReply ? chatInput.replyMessageId : "", chatInput.isReply ? chatInput.replyMessageId : "",
packId, packId,
@ -320,10 +328,6 @@ Item {
} }
} }
onUnblockChat: {
}
onKeyUpPress: { onKeyUpPress: {
d.activeMessagesStore.setEditModeOnLastMessage(root.rootStore.userProfileInst.pubKey) d.activeMessagesStore.setEditModeOnLastMessage(root.rootStore.userProfileInst.pubKey)
} }
@ -333,11 +337,12 @@ Item {
Layout.fillHeight: true Layout.fillHeight: true
Layout.maximumHeight: chatInput.implicitHeight Layout.maximumHeight: chatInput.implicitHeight
verticalPadding: 0 verticalPadding: 0
visible: d.activeChatContentModule.chatDetails.blocked visible: !!d.activeChatContentModule && d.activeChatContentModule.chatDetails.blocked
text: qsTr("Unblock") text: qsTr("Unblock")
type: StatusBaseButton.Type.Danger type: StatusBaseButton.Type.Danger
onClicked: { onClicked: {
d.activeChatContentModule.unblockChat() if (!!d.activeChatContentModule)
d.activeChatContentModule.unblockChat()
} }
} }
} }

View File

@ -27,7 +27,6 @@ Rectangle {
signal receiveTransactionCommandButtonClicked() signal receiveTransactionCommandButtonClicked()
signal stickerSelected(string hashId, string packId, string url) signal stickerSelected(string hashId, string packId, string url)
signal sendMessage(var event) signal sendMessage(var event)
signal unblockChat()
signal keyUpPress() signal keyUpPress()
property var usersStore property var usersStore