fix(Communities): Show channel for non-members when read-only, tokenless permission is set
When channel has view-only permission not requiring any holdings, the channel is not encrypted and should be presented to non-members in read-only mode. Closes: #14439
This commit is contained in:
parent
93d808d020
commit
d2f73cd88f
|
@ -155,6 +155,44 @@ StackLayout {
|
||||||
root.sectionItemModel.memberRole === Constants.memberRole.admin ||
|
root.sectionItemModel.memberRole === Constants.memberRole.admin ||
|
||||||
root.sectionItemModel.memberRole === Constants.memberRole.tokenMaster
|
root.sectionItemModel.memberRole === Constants.memberRole.tokenMaster
|
||||||
hasViewOnlyPermissions: root.permissionsStore.viewOnlyPermissionsModel.count > 0
|
hasViewOnlyPermissions: root.permissionsStore.viewOnlyPermissionsModel.count > 0
|
||||||
|
|
||||||
|
hasUnrestrictedViewOnlyPermission: {
|
||||||
|
viewOnlyUnrestrictedPermissionHelper.revision
|
||||||
|
|
||||||
|
const model = root.permissionsStore.viewOnlyPermissionsModel
|
||||||
|
const count = model.rowCount()
|
||||||
|
|
||||||
|
for (let i = 0; i < count; i++) {
|
||||||
|
const holdings = ModelUtils.get(model, i, "holdingsListModel")
|
||||||
|
|
||||||
|
if (holdings.rowCount() === 0)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
Instantiator {
|
||||||
|
id: viewOnlyUnrestrictedPermissionHelper
|
||||||
|
|
||||||
|
model: root.permissionsStore.viewOnlyPermissionsModel
|
||||||
|
|
||||||
|
property int revision: 0
|
||||||
|
|
||||||
|
delegate: QObject {
|
||||||
|
ModelChangeTracker {
|
||||||
|
model: model.holdingsListModel
|
||||||
|
|
||||||
|
onRevisionChanged: viewOnlyUnrestrictedPermissionHelper.revision++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ModelChangeTracker {
|
||||||
|
model: root.permissionsStore.viewOnlyPermissionsModel
|
||||||
|
onRevisionChanged: viewOnlyUnrestrictedPermissionHelper.revision++
|
||||||
|
}
|
||||||
|
|
||||||
hasViewAndPostPermissions: root.permissionsStore.viewAndPostPermissionsModel.count > 0
|
hasViewAndPostPermissions: root.permissionsStore.viewAndPostPermissionsModel.count > 0
|
||||||
viewOnlyPermissionsModel: root.permissionsStore.viewOnlyPermissionsModel
|
viewOnlyPermissionsModel: root.permissionsStore.viewOnlyPermissionsModel
|
||||||
viewAndPostPermissionsModel: root.permissionsStore.viewAndPostPermissionsModel
|
viewAndPostPermissionsModel: root.permissionsStore.viewAndPostPermissionsModel
|
||||||
|
|
|
@ -51,7 +51,10 @@ StatusSectionLayout {
|
||||||
readonly property var chatContentModule: rootStore.currentChatContentModule() || null
|
readonly property var chatContentModule: rootStore.currentChatContentModule() || null
|
||||||
readonly property bool viewOnlyPermissionsSatisfied: chatContentModule.viewOnlyPermissionsSatisfied
|
readonly property bool viewOnlyPermissionsSatisfied: chatContentModule.viewOnlyPermissionsSatisfied
|
||||||
readonly property bool viewAndPostPermissionsSatisfied: chatContentModule.viewAndPostPermissionsSatisfied
|
readonly property bool viewAndPostPermissionsSatisfied: chatContentModule.viewAndPostPermissionsSatisfied
|
||||||
|
|
||||||
property bool hasViewOnlyPermissions: false
|
property bool hasViewOnlyPermissions: false
|
||||||
|
property bool hasUnrestrictedViewOnlyPermission: false
|
||||||
|
|
||||||
property bool hasViewAndPostPermissions: false
|
property bool hasViewAndPostPermissions: false
|
||||||
property bool amIMember: false
|
property bool amIMember: false
|
||||||
property bool amISectionAdmin: false
|
property bool amISectionAdmin: false
|
||||||
|
@ -92,6 +95,9 @@ StatusSectionLayout {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (!amIMember) {
|
if (!amIMember) {
|
||||||
|
if (hasUnrestrictedViewOnlyPermission)
|
||||||
|
return false
|
||||||
|
|
||||||
return hasViewAndPostPermissions || hasViewOnlyPermissions
|
return hasViewAndPostPermissions || hasViewOnlyPermissions
|
||||||
}
|
}
|
||||||
if (amISectionAdmin) {
|
if (amISectionAdmin) {
|
||||||
|
|
Loading…
Reference in New Issue