Skip to content

Commit d9f08c3

Browse files
Hide share button in TreeViewBase if user does not have permissions t… (#5550)
* Hide share button in TreeViewBase if user does not have permissions to see any option * [pre-commit.ci lite] apply automatic fixes * fix linting * fix test file --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 9932b7d commit d9f08c3

File tree

2 files changed

+428
-3
lines changed

2 files changed

+428
-3
lines changed

contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
>
8585
{{ $tr('apiGenerated') }}
8686
</span>
87-
<BaseMenu>
87+
<BaseMenu v-if="canShareChannel">
8888
<template #activator="{ on }">
8989
<KButton
9090
hasDropdown
@@ -95,16 +95,23 @@
9595
</KButton>
9696
</template>
9797
<VList>
98-
<VListTile @click="showSubmitToCommunityLibrarySidePanel = true">
98+
<VListTile
99+
v-if="canSubmitToCommunityLibrary"
100+
@click="showSubmitToCommunityLibrarySidePanel = true"
101+
>
99102
<VListTileTitle>{{ $tr('submitToCommunityLibrary') }}</VListTileTitle>
100103
</VListTile>
101104
<VListTile
105+
v-if="canManage"
102106
:to="shareChannelLink"
103107
@click="trackClickEvent('Share channel')"
104108
>
105109
<VListTileTitle>{{ $tr('inviteCollaborators') }}</VListTileTitle>
106110
</VListTile>
107-
<VListTile @click="showTokenModal = true">
111+
<VListTile
112+
v-if="isPublished"
113+
@click="showTokenModal = true"
114+
>
108115
<VListTileTitle>{{ $tr('shareToken') }}</VListTileTitle>
109116
</VListTile>
110117
</VList>
@@ -454,6 +461,15 @@
454461
!this.loading && (this.$vuetify.breakpoint.xsOnly || this.canManage || this.isPublished)
455462
);
456463
},
464+
canShareChannel() {
465+
return this.canManage || this.isPublished;
466+
},
467+
canSubmitToCommunityLibrary() {
468+
if (!this.currentChannel) {
469+
return false;
470+
}
471+
return this.canManage && this.isPublished && !this.currentChannel.public;
472+
},
457473
viewChannelDetailsLink() {
458474
return {
459475
name: ChannelRouteNames.CHANNEL_DETAILS,

0 commit comments

Comments
 (0)