mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-23 03:58:49 +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
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
visible: model.active && !root.rootStore.openCreateChat && isActiveChannel
|
visible: model.active && !root.rootStore.openCreateChat && isActiveChannel
|
||||||
|
chatId: model.itemId
|
||||||
chatMessagesLoader.active: model.loaderActive
|
chatMessagesLoader.active: model.loaderActive
|
||||||
rootStore: root.rootStore
|
rootStore: root.rootStore
|
||||||
contactsStore: root.contactsStore
|
contactsStore: root.contactsStore
|
||||||
@ -149,7 +150,6 @@ Item {
|
|||||||
sendTransactionWithEnsModal: cmpSendTransactionWithEns
|
sendTransactionWithEnsModal: cmpSendTransactionWithEns
|
||||||
stickersLoaded: root.stickersLoaded
|
stickersLoaded: root.stickersLoaded
|
||||||
isBlocked: model.blocked
|
isBlocked: model.blocked
|
||||||
isUserAdded: root.isUserAdded
|
|
||||||
isActiveChannel: model.active
|
isActiveChannel: model.active
|
||||||
onOpenStickerPackPopup: {
|
onOpenStickerPackPopup: {
|
||||||
root.openStickerPackPopup(stickerPackId)
|
root.openStickerPackPopup(stickerPackId)
|
||||||
|
@ -35,6 +35,7 @@ ColumnLayout {
|
|||||||
property var rootStore
|
property var rootStore
|
||||||
property var contactsStore
|
property var contactsStore
|
||||||
property bool isActiveChannel: false
|
property bool isActiveChannel: false
|
||||||
|
property string chatId
|
||||||
|
|
||||||
readonly property alias chatMessagesLoader: chatMessagesLoader
|
readonly property alias chatMessagesLoader: chatMessagesLoader
|
||||||
|
|
||||||
@ -54,16 +55,37 @@ ColumnLayout {
|
|||||||
property Component sendTransactionWithEnsModal
|
property Component sendTransactionWithEnsModal
|
||||||
|
|
||||||
property bool isBlocked: false
|
property bool isBlocked: false
|
||||||
property bool isUserAdded: false
|
|
||||||
|
|
||||||
property bool stickersLoaded: 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: {
|
onIsActiveChannelChanged: {
|
||||||
if (isActiveChannel) {
|
if (isActiveChannel) {
|
||||||
chatInput.forceInputActiveFocus();
|
chatInput.forceInputActiveFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root.contactsStore.myContactsModel
|
||||||
|
|
||||||
|
function onItemChanged(pubKey) {
|
||||||
|
if (pubKey === root.chatId) {
|
||||||
|
d.updateIsUserAdded()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
active: root.isBlocked
|
active: root.isBlocked
|
||||||
@ -83,7 +105,7 @@ ColumnLayout {
|
|||||||
id: contextmenu
|
id: contextmenu
|
||||||
store: root.rootStore
|
store: root.rootStore
|
||||||
reactionModel: root.rootStore.emojiReactionsModel
|
reactionModel: root.rootStore.emojiReactionsModel
|
||||||
disabledForChat: chatType === Constants.chatType.oneToOne && !root.isUserAdded
|
disabledForChat: chatType === Constants.chatType.oneToOne && !d.isUserAdded
|
||||||
|
|
||||||
onPinMessage: {
|
onPinMessage: {
|
||||||
messageStore.pinMessage(messageId)
|
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")
|
console.warn("error on open pinned messages limit reached from message context menu - chat content module is not set")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const chatId = chatType === Constants.chatType.oneToOne ? chatContentModule.getMyChatId() : ""
|
Global.openPinnedMessagesPopupRequested(rootStore, messageStore, chatContentModule.pinnedMessagesModel, messageId, root.chatId)
|
||||||
Global.openPinnedMessagesPopupRequested(rootStore, messageStore, chatContentModule.pinnedMessagesModel, messageId, chatId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onToggleReaction: {
|
onToggleReaction: {
|
||||||
@ -149,7 +170,7 @@ ColumnLayout {
|
|||||||
stickersPopup: root.stickersPopup
|
stickersPopup: root.stickersPopup
|
||||||
usersStore: root.usersStore
|
usersStore: root.usersStore
|
||||||
stickersLoaded: root.stickersLoaded
|
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 || "")
|
channelEmoji: !chatContentModule ? "" : (chatContentModule.chatDetails.emoji || "")
|
||||||
isActiveChannel: root.isActiveChannel
|
isActiveChannel: root.isActiveChannel
|
||||||
onShowReplyArea: {
|
onShowReplyArea: {
|
||||||
@ -181,7 +202,7 @@ ColumnLayout {
|
|||||||
anchors.margins: Style.current.smallPadding
|
anchors.margins: Style.current.smallPadding
|
||||||
|
|
||||||
enabled: root.rootStore.sectionDetails.joined && !root.rootStore.sectionDetails.amIBanned &&
|
enabled: root.rootStore.sectionDetails.joined && !root.rootStore.sectionDetails.amIBanned &&
|
||||||
!(chatType === Constants.chatType.oneToOne && !root.isUserAdded)
|
!(chatType === Constants.chatType.oneToOne && !d.isUserAdded)
|
||||||
|
|
||||||
store: root.rootStore
|
store: root.rootStore
|
||||||
usersStore: root.usersStore
|
usersStore: root.usersStore
|
||||||
|
Loading…
x
Reference in New Issue
Block a user