mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-22 19:48:52 +00:00
fix(chat): correct isAdded
behavior
`isAdded` for specific chat was always reflecting the active chat property, effectively causing the chat inputs of these chats to be disabled and, as a consequence, making the input vanish. fixes: https://github.com/status-im/status-desktop/pull/10343#issuecomment-1512825761
This commit is contained in:
parent
36063f33f1
commit
7f3a66b68d
@ -139,6 +139,7 @@ Item {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
visible: model.active && !root.rootStore.openCreateChat && isActiveChannel
|
||||
chatId: model.itemId
|
||||
chatMessagesLoader.active: model.loaderActive
|
||||
rootStore: root.rootStore
|
||||
contactsStore: root.contactsStore
|
||||
@ -149,7 +150,6 @@ Item {
|
||||
sendTransactionWithEnsModal: cmpSendTransactionWithEns
|
||||
stickersLoaded: root.stickersLoaded
|
||||
isBlocked: model.blocked
|
||||
isUserAdded: root.isUserAdded
|
||||
isActiveChannel: model.active
|
||||
onOpenStickerPackPopup: {
|
||||
root.openStickerPackPopup(stickerPackId)
|
||||
|
@ -35,6 +35,7 @@ ColumnLayout {
|
||||
property var rootStore
|
||||
property var contactsStore
|
||||
property bool isActiveChannel: false
|
||||
property string chatId
|
||||
|
||||
readonly property alias chatMessagesLoader: chatMessagesLoader
|
||||
|
||||
@ -54,16 +55,37 @@ ColumnLayout {
|
||||
property Component sendTransactionWithEnsModal
|
||||
|
||||
property bool isBlocked: false
|
||||
property bool isUserAdded: false
|
||||
|
||||
property bool stickersLoaded: false
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
|
||||
property bool isUserAdded
|
||||
|
||||
function updateIsUserAdded() {
|
||||
isUserAdded = Qt.binding(() => {isActiveChannel; return Utils.getContactDetailsAsJson(root.chatId, false).isAdded})
|
||||
}
|
||||
|
||||
Component.onCompleted: updateIsUserAdded()
|
||||
}
|
||||
|
||||
onIsActiveChannelChanged: {
|
||||
if (isActiveChannel) {
|
||||
chatInput.forceInputActiveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root.contactsStore.myContactsModel
|
||||
|
||||
function onItemChanged(pubKey) {
|
||||
if (pubKey === root.chatId) {
|
||||
d.updateIsUserAdded()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
Layout.fillWidth: true
|
||||
active: root.isBlocked
|
||||
@ -83,7 +105,7 @@ ColumnLayout {
|
||||
id: contextmenu
|
||||
store: root.rootStore
|
||||
reactionModel: root.rootStore.emojiReactionsModel
|
||||
disabledForChat: chatType === Constants.chatType.oneToOne && !root.isUserAdded
|
||||
disabledForChat: chatType === Constants.chatType.oneToOne && !d.isUserAdded
|
||||
|
||||
onPinMessage: {
|
||||
messageStore.pinMessage(messageId)
|
||||
@ -98,8 +120,7 @@ ColumnLayout {
|
||||
console.warn("error on open pinned messages limit reached from message context menu - chat content module is not set")
|
||||
return
|
||||
}
|
||||
const chatId = chatType === Constants.chatType.oneToOne ? chatContentModule.getMyChatId() : ""
|
||||
Global.openPinnedMessagesPopupRequested(rootStore, messageStore, chatContentModule.pinnedMessagesModel, messageId, chatId)
|
||||
Global.openPinnedMessagesPopupRequested(rootStore, messageStore, chatContentModule.pinnedMessagesModel, messageId, root.chatId)
|
||||
}
|
||||
|
||||
onToggleReaction: {
|
||||
@ -149,7 +170,7 @@ ColumnLayout {
|
||||
stickersPopup: root.stickersPopup
|
||||
usersStore: root.usersStore
|
||||
stickersLoaded: root.stickersLoaded
|
||||
isChatBlocked: root.isBlocked || (chatContentModule && chatContentModule.chatDetails.type === Constants.chatType.oneToOne && !root.isUserAdded)
|
||||
isChatBlocked: root.isBlocked || (chatContentModule && chatContentModule.chatDetails.type === Constants.chatType.oneToOne && !d.isUserAdded)
|
||||
channelEmoji: !chatContentModule ? "" : (chatContentModule.chatDetails.emoji || "")
|
||||
isActiveChannel: root.isActiveChannel
|
||||
onShowReplyArea: {
|
||||
@ -181,7 +202,7 @@ ColumnLayout {
|
||||
anchors.margins: Style.current.smallPadding
|
||||
|
||||
enabled: root.rootStore.sectionDetails.joined && !root.rootStore.sectionDetails.amIBanned &&
|
||||
!(chatType === Constants.chatType.oneToOne && !root.isUserAdded)
|
||||
!(chatType === Constants.chatType.oneToOne && !d.isUserAdded)
|
||||
|
||||
store: root.rootStore
|
||||
usersStore: root.usersStore
|
||||
|
Loading…
x
Reference in New Issue
Block a user