refactor(ChatContentView): only get contact details when 1-1 chat

This commit is contained in:
Jonathan Rainville 2023-04-20 15:45:13 -04:00
parent 0c9b568b95
commit 435b08501b
2 changed files with 5 additions and 0 deletions

View File

@ -140,6 +140,7 @@ Item {
height: parent.height
visible: !root.rootStore.openCreateChat && isActiveChannel
chatId: model.itemId
activeChatType: root.activeChatType
chatMessagesLoader.active: model.loaderActive
rootStore: root.rootStore
contactsStore: root.contactsStore

View File

@ -37,6 +37,7 @@ ColumnLayout {
property var contactsStore
property bool isActiveChannel: false
property string chatId
property int activeChatType
readonly property alias chatMessagesLoader: chatMessagesLoader
@ -65,6 +66,9 @@ ColumnLayout {
property bool isUserAdded
function updateIsUserAdded() {
if (activeChatType !== Constants.chatType.oneToOne) {
return false
}
isUserAdded = Qt.binding(() => {isActiveChannel; return Utils.getContactDetailsAsJson(root.chatId, false).isAdded})
}