Skip to content

Commit b881d73

Browse files
committed
Hide draft option from PublishSidePanel if user does not have enabled
1 parent 1cb649a commit b881d73

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313

1414
<template #default>
1515
<div>
16-
<KRadioButtonGroup>
16+
<component :is="showDraftMode ? 'KRadioButtonGroup' : 'div'">
1717
<KRadioButton
18+
v-if="showDraftMode"
1819
:label="modeLive$()"
1920
:buttonValue="PublishModes.LIVE"
2021
:currentValue="mode"
@@ -26,7 +27,7 @@
2627
<div
2728
v-if="mode === PublishModes.LIVE"
2829
class="live-mode-content"
29-
style="margin-top: 16px; margin-left: 24px"
30+
:style="showDraftMode ? { marginLeft: '24px', marginTop: '16px' } : {}"
3031
>
3132
<div class="live-publish-info">
3233
<KIcon
@@ -126,13 +127,14 @@
126127
</div>
127128

128129
<KRadioButton
130+
v-if="showDraftMode"
129131
:label="modeDraft$()"
130132
:buttonValue="PublishModes.DRAFT"
131133
:currentValue="mode"
132134
:description="modeDraftDescription$()"
133135
@input="mode = PublishModes.DRAFT"
134136
/>
135-
</KRadioButtonGroup>
137+
</component>
136138
</div>
137139
</template>
138140

@@ -166,6 +168,7 @@
166168
import { communityChannelsStrings } from 'shared/strings/communityChannelsStrings';
167169
import { LanguagesList } from 'shared/leUtils/Languages';
168170
import logging from 'shared/logging';
171+
import { FeatureFlagKeys } from 'shared/constants';
169172
170173
export default {
171174
name: 'PublishSidePanel',
@@ -221,6 +224,7 @@
221224
const currentChannel = computed(() => store.getters['currentChannel/currentChannel']);
222225
const getContentNode = computed(() => store.getters['contentNode/getContentNode']);
223226
const areAllChangesSaved = computed(() => store.getters['areAllChangesSaved']);
227+
const hasFeatureEnabled = computed(() => store.getters['hasFeatureEnabled']);
224228
225229
const incompleteResourcesCount = computed(() => {
226230
if (!currentChannel.value) return 0;
@@ -259,6 +263,10 @@
259263
return true;
260264
});
261265
266+
const showDraftMode = computed(() =>
267+
hasFeatureEnabled.value(FeatureFlagKeys.test_dev_feature),
268+
);
269+
262270
const submitText = computed(() => {
263271
return mode.value === PublishModes.DRAFT ? saveDraft$() : publishAction$();
264272
});
@@ -392,6 +400,7 @@
392400
isChannelLanguageLoading,
393401
PublishModes,
394402
mode,
403+
showDraftMode,
395404
version_notes,
396405
submitting,
397406
languageOptions,

contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/__tests__/PublishSidePanel.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const renderComponent = (props = {}) => {
5151
store.commit('channel/ADD_CHANNEL', currentChannel);
5252
store.commit('contentNode/ADD_CONTENTNODE', rootNode);
5353
store.commit('SET_UNSAVED_CHANGES', props.areAllChangesSaved === false);
54+
store.commit('UPDATE_SESSION', { is_admin: true });
5455

5556
const router = new VueRouter();
5657

0 commit comments

Comments
 (0)