fix(communities): fix icon, members and color + set observed and active

Fixes #4569
Fixes #4567
This commit is contained in:
Jonathan Rainville 2022-01-25 15:07:03 -05:00 committed by Sale Djenic
parent dc9f601ede
commit 47fa644703
4 changed files with 23 additions and 21 deletions

View File

@ -113,26 +113,25 @@ StatusModal {
return true
}
const lowerCaseSearchStr = searchBox.input.text.toLowerCase()
return name.toLowerCase().includes(lowerCaseSearchStr) || description.toLowerCase().includes(lowerCaseSearchStr)
return model.name.toLowerCase().includes(lowerCaseSearchStr) || model.description.toLowerCase().includes(lowerCaseSearchStr)
}
height: visible ? implicitHeight : 0
anchors.horizontalCenter: parent.horizontalCenter
title: name
subTitle: description
// TODO refactor members in the backend
title: model.name
subTitle: model.description
//% "%1 members"
// tertiaryTitle: qsTrId("-1-members").arg(nbMembers)
tertiaryTitle: qsTrId("-1-members").arg(model.members.count)
statusListItemTitle.font.weight: Font.Bold
statusListItemTitle.font.pixelSize: 17
image.source: model.image
icon.isLetterIdenticon: !image
icon.background.color: color
icon.isLetterIdenticon: !model.image
icon.background.color: model.color || Theme.palette.primaryColor1
sensor.onClicked: {
if (joined && isMember) {
popup.setActiveCommunity(id);
if (model.joined && model.isMember) {
popup.setActiveCommunity(model.id);
} else {
popup.setObservedCommunity(id);
popup.setObservedCommunity(model.id);
Global.openPopup(communityDetailPopup)
}
popup.close()

View File

@ -25,6 +25,14 @@ QtObject {
// Contact requests related part
property var contactRequestsModel: chatCommunitySectionModule.contactRequestsModel
function setActiveCommunity(communityId) {
mainModule.setActiveSectionById(communityId);
}
function setObservedCommunity(communityId) {
communitiesModuleInst.setObservedCommunity(communityId);
}
function acceptContactRequest(pubKey) {
chatCommunitySectionModule.acceptContactRequest(pubKey)
}

View File

@ -369,13 +369,12 @@ Item {
CommunitiesPopup {
anchors.centerIn: parent
communitiesList: root.store.communitiesList
// Not Refactored Yet
// onSetActiveCommunity: {
// root.store.chatsModelInst.communities.setActiveCommunity(id)
// }
onSetObservedCommunity: {
root.store.setObservedCommunity(id)
}
onSetActiveCommunity: {
root.store.setActiveCommunity(id)
}
onSetObservedCommunity: {
root.store.setObservedCommunity(id)
}
onClosed: {
destroy()
}

View File

@ -35,10 +35,6 @@ QtObject {
property real volume: !!localAccountSensitiveSettings ? localAccountSensitiveSettings.volume : 0.0
property bool notificationSoundsEnabled: !!localAccountSensitiveSettings ? localAccountSensitiveSettings.notificationSoundsEnabled : false
function setObservedCommunity(communityId) {
communitiesModuleInst.setObservedCommunity(communityId);
}
function createCommunity(communityName, communityDescription, checkedMembership, ensOnlySwitchChecked, communityColor, communityImage, imageCropperModalaX, imageCropperModalaY, imageCropperModalbX, imageCropperModalbY) {
communitiesModuleInst.createCommunity(communityName, communityDescription, checkedMembership, ensOnlySwitchChecked, communityColor, communityImage, imageCropperModalaX, imageCropperModalaY, imageCropperModalbX, imageCropperModalbY);
}