fix: fix community edit, popup opens and banners

Fixes #3960
This commit is contained in:
Jonathan Rainville 2021-11-02 15:39:18 -04:00 committed by Iuri Matias
parent 2e2c54229b
commit a5954d3bf3
6 changed files with 35 additions and 11 deletions

View File

@ -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()
}
}
}

View File

@ -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
}
}

View File

@ -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 {

View File

@ -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")
}]
}

View File

@ -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

View File

@ -647,7 +647,6 @@ Item {
id: communityProfilePopup
CommunityProfilePopup {
id: communityProfilePopup
anchors.centerIn: parent
onClosed: {