fix(JoinCommunity): Merge issues solved and channel hidden logic fixed

- Removed function in merge while it's still needed.
- Modified logic when channels hidden to take into account also `viewOnly` permission cases.
This commit is contained in:
Noelia 2024-03-28 13:37:25 +01:00 committed by Jonathan Rainville
parent 4144e374a6
commit d568ceb444
1 changed files with 19 additions and 6 deletions

View File

@ -58,7 +58,7 @@ Control {
filters: [
// The only permissions to be discarded are if they are private and NOT met
FastExpressionFilter {
expression: { return !!model && !(!model.tokenCriteriaMet && model.isPrivate) }
expression: d.filterPermissions(model)
expectedRoles: ["tokenCriteriaMet", "isPrivate"]
}
]
@ -90,6 +90,10 @@ Control {
}
]
}
function filterPermissions(model) {
return !!model && (model.tokenCriteriaMet || !model.isPrivate)
}
}
padding: 35 // default by design
@ -118,8 +122,18 @@ Control {
model: d.visiblePermissionsModel
}
StatusBaseText {
Layout.fillWidth: true
visible: root.allChannelsAreHiddenBecauseNotPermitted
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
text: d.allChannelsAreHiddenBecauseNotPermittedText
textFormat: Text.StyledText
}
CustomHoldingsListPanel {
visible: !root.joinCommunity && d.viewOnlyPermissionsModel.count > 0
visible: (!root.joinCommunity && d.viewOnlyPermissionsModel.count > 0) && !root.allChannelsAreHiddenBecauseNotPermitted
introText: root.requiresRequest ?
qsTr("To view the <b>#%1</b> channel you need to join <b>%2</b> and prove that you hold").arg(root.channelName).arg(root.communityName) :
qsTr("To view the <b>#%1</b> channel you need to hold").arg(root.channelName)
@ -127,9 +141,8 @@ Control {
}
CustomHoldingsListPanel {
visible: (!root.joinCommunity && d.viewAndPostPermissionsModel.count > 0) || root.allChannelsAreHiddenBecauseNotPermitted
introText: root.allChannelsAreHiddenBecauseNotPermitted ? d.allChannelsAreHiddenBecauseNotPermittedText :
root.requiresRequest ? qsTr("To view and post in the <b>#%1</b> channel you need to join <b>%2</b> and prove that you hold").arg(root.channelName).arg(root.communityName) :
visible: (!root.joinCommunity && d.viewAndPostPermissionsModel.count > 0) && !root.allChannelsAreHiddenBecauseNotPermitted
introText: root.requiresRequest ? qsTr("To view and post in the <b>#%1</b> channel you need to join <b>%2</b> and prove that you hold").arg(root.channelName).arg(root.communityName) :
qsTr("To view and post in the <b>#%1</b> channel you need to hold").arg(root.channelName)
model: d.viewAndPostPermissionsModel
}