From 6f8f9b6f7656617d3124da8d4134fb8278a43ae1 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Mon, 17 Jan 2022 13:49:30 -0500 Subject: [PATCH] fix(community): fix qml errors when creating a community Fixes #4440 --- ui/app/AppLayouts/Chat/ChatLayout.qml | 17 ++++++++++++++--- .../Chat/views/CommunityColumnView.qml | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ui/app/AppLayouts/Chat/ChatLayout.qml b/ui/app/AppLayouts/Chat/ChatLayout.qml index c0fb366b81..8399ae92e8 100644 --- a/ui/app/AppLayouts/Chat/ChatLayout.qml +++ b/ui/app/AppLayouts/Chat/ChatLayout.qml @@ -77,9 +77,16 @@ StatusAppThreePanelLayout { } showRightPanel: { - // Check if user list is available as an option for particular chat content module. - let usersListAvailable = root.rootStore.currentChatContentModule().chatDetails.isUsersListAvailable - return localAccountSensitiveSettings.showOnlineUsers && usersListAvailable && localAccountSensitiveSettings.expandUsersList + if (!localAccountSensitiveSettings.showOnlineUsers || !localAccountSensitiveSettings.expandUsersList) { + return false + } + let chatContentModule = root.rootStore.currentChatContentModule() + if (!chatContentModule) { + // New communities have no chats, so no chatContentModule + return false + } + // Check if user list is available as an option for particular chat content module + return chatContentModule.chatDetails.isUsersListAvailable } rightPanel: localAccountSensitiveSettings.communitiesEnabled && root.rootStore.chatCommunitySectionModule.isCommunity()? @@ -92,6 +99,10 @@ StatusAppThreePanelLayout { messageContextMenu: quickActionMessageOptionsMenu usersModule: { let chatContentModule = root.rootStore.currentChatContentModule() + if (!chatContentModule || !chatContentModule.usersModule) { + // New communities have no chats, so no chatContentModule + return {} + } return chatContentModule.usersModule } } diff --git a/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml b/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml index f1b844cd32..af48f8274d 100644 --- a/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml @@ -343,7 +343,7 @@ Item { width: parent.width height: { // I dont know why, the binding doesn't work well if this isn't here - item.height + item && item.height return this.active ? item.height : 0 } anchors.top: communityChatListAndCategories.bottom