From a5954d3bf32b7942e3594983ba8365c2cd5fc7f8 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 2 Nov 2021 15:39:18 -0400 Subject: [PATCH] fix: fix community edit, popup opens and banners Fixes #3960 --- .../communities/BackUpCommuntyBannerPanel.qml | 10 +++++++--- .../communities/CommunityWelcomeBannerPanel.qml | 7 +++++-- .../popups/community/CommunityProfilePopup.qml | 14 +++++++++++++- .../Chat/popups/community/CreateCommunityPopup.qml | 4 ++-- .../AppLayouts/Chat/views/CommunityColumnView.qml | 10 ++++++++-- ui/app/AppMain.qml | 1 - 6 files changed, 35 insertions(+), 11 deletions(-) diff --git a/ui/app/AppLayouts/Chat/panels/communities/BackUpCommuntyBannerPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/BackUpCommuntyBannerPanel.qml index 5862beb635..7abdfa281d 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/BackUpCommuntyBannerPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/BackUpCommuntyBannerPanel.qml @@ -10,6 +10,8 @@ import utils 1.0 import "../../popups/community" Rectangle { + property var activeCommunity + id: root height: childrenRect.height + Style.current.padding anchors.left: parent.left @@ -71,10 +73,12 @@ Rectangle { TransferOwnershipPopup { anchors.centerIn: parent onClosed: { - let hiddenBannerIds = localAccountSensitiveSettings.hiddenCommunityBackUpBanners - hiddenBannerIds.push(chatsModel.communities.activeCommunity.id) + let hiddenBannerIds = localAccountSensitiveSettings.hiddenCommunityBackUpBanners || [] + if (hiddenBannerIds.includes(root.activeCommunity.id)) { + return + } + hiddenBannerIds.push(root.activeCommunity.id) localAccountSensitiveSettings.hiddenCommunityBackUpBanners = hiddenBannerIds - destroy() } } } diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityWelcomeBannerPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityWelcomeBannerPanel.qml index 16ee6e9544..aa6822dbca 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityWelcomeBannerPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityWelcomeBannerPanel.qml @@ -22,6 +22,7 @@ Rectangle { radius: 16 color: Style.current.transparent property var activeCommunity + property var store MouseArea { anchors.fill: parent @@ -55,10 +56,12 @@ Rectangle { icon.name: "close-circle" type: StatusQControls.StatusFlatRoundButton.Type.Tertiary onClicked: { - let hiddenBannerIds = localAccountSensitiveSettings.hiddenCommunityWelcomeBanners + let hiddenBannerIds = localAccountSensitiveSettings.hiddenCommunityWelcomeBanners || [] + if (hiddenBannerIds.includes(root.activeCommunity.id)) { + return + } hiddenBannerIds.push(root.activeCommunity.id) localAccountSensitiveSettings.hiddenCommunityWelcomeBanners = hiddenBannerIds - root.visible = false } } diff --git a/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml b/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml index 41cdfd583e..fec348f06a 100644 --- a/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml @@ -24,7 +24,7 @@ StatusModal { header.title: contentItem.currentItem.headerTitle header.subTitle: contentItem.currentItem.headerSubtitle || "" header.image.source: contentItem.currentItem.headerImageSource || "" - header.icon.isLetterIdenticon: contentItem.currentItem.headerTitle == root.community.name && !contentItem.currentItem.headerImageSource + header.icon.isLetterIdenticon: contentItem.currentItem.headerTitle === root.community.name && !contentItem.currentItem.headerImageSource header.icon.background.color: root.community.communityColor contentItem: StackView { @@ -88,6 +88,18 @@ StatusModal { } } + Component { + id: editCommunityroot + CreateCommunityPopup { + anchors.centerIn: parent + store: root.store + isEdit: true + onClosed: { + destroy() + } + } + } + Component { id: membersList CommunityProfilePopupMembersListPanel { diff --git a/ui/app/AppLayouts/Chat/popups/community/CreateCommunityPopup.qml b/ui/app/AppLayouts/Chat/popups/community/CreateCommunityPopup.qml index c5cc055187..604531ffdb 100644 --- a/ui/app/AppLayouts/Chat/popups/community/CreateCommunityPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/CreateCommunityPopup.qml @@ -94,7 +94,7 @@ StatusModal { input.placeholderText: qsTr("A catchy name") validators: [StatusMinLengthValidator { minLength: 1 - errorMessage: Utils.getErrorMessage(errors, "community name") + errorMessage: Utils.getErrorMessage(nameInput.errors, "community name") }] } @@ -109,7 +109,7 @@ StatusModal { validators: [StatusMinLengthValidator { minLength: 1 - errorMessage: Utils.getErrorMessage(errors, "community description") + errorMessage: Utils.getErrorMessage(descriptionTextArea.errors, "community description") }] } diff --git a/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml b/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml index 2246ebd9cc..3401daa7a5 100644 --- a/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml @@ -237,7 +237,9 @@ Item { Loader { id: emptyViewAndSuggestionsLoader - active: root.store.chatsModelInst.communities.activeCommunity.admin && !localAccountSensitiveSettings.hiddenCommunityWelcomeBanners.includes(root.store.chatsModelInst.communities.activeCommunity.id) + active: root.store.chatsModelInst.communities.activeCommunity.admin && + (!localAccountSensitiveSettings.hiddenCommunityWelcomeBanners || + !localAccountSensitiveSettings.hiddenCommunityWelcomeBanners.includes(root.store.chatsModelInst.communities.activeCommunity.id)) width: parent.width height: active ? item.height : 0 anchors.top: communityChatListAndCategories.bottom @@ -245,13 +247,16 @@ Item { sourceComponent: Component { CommunityWelcomeBannerPanel { activeCommunity: store.activeCommunity + store: root.store } } } Loader { id: backUpBannerLoader - active: root.store.chatsModelInst.communities.activeCommunity.admin && !localAccountSensitiveSettings.hiddenCommunityBackUpBanners.includes(root.store.chatsModelInst.communities.activeCommunity.id) + active: root.store.chatsModelInst.communities.activeCommunity.admin && + (!localAccountSensitiveSettings.hiddenCommunityBackUpBanners || + !localAccountSensitiveSettings.hiddenCommunityBackUpBanners.includes(root.store.chatsModelInst.communities.activeCommunity.id)) width: parent.width height: active ? item.height : 0 anchors.top: emptyViewAndSuggestionsLoader.bottom @@ -263,6 +268,7 @@ Item { BackUpCommuntyBannerPanel { id: backupBanner + activeCommunity: store.activeCommunity } MouseArea { anchors.fill: backupBanner diff --git a/ui/app/AppMain.qml b/ui/app/AppMain.qml index 0d12977cf1..d82b07c86a 100644 --- a/ui/app/AppMain.qml +++ b/ui/app/AppMain.qml @@ -647,7 +647,6 @@ Item { id: communityProfilePopup CommunityProfilePopup { - id: communityProfilePopup anchors.centerIn: parent onClosed: {