diff options
Diffstat (limited to 'app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue')
-rw-r--r-- | app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue b/app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue index 80928649a03..86bfacbfb9e 100644 --- a/app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue +++ b/app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue @@ -1,22 +1,24 @@ <script> import $ from 'jquery'; import { GlLoadingIcon } from '@gitlab/ui'; -import { mapActions, mapState } from 'vuex'; +import { mapActions } from 'vuex'; import { __ } from '~/locale'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import Flash from '~/flash'; +import { deprecatedCreateFlash as Flash } from '~/flash'; import eventHub from '../../event_hub'; export default { components: { GlLoadingIcon, }, - mixins: [glFeatureFlagsMixin()], props: { fullPath: { required: true, type: String, }, + confidential: { + required: true, + type: Boolean, + }, }, data() { return { @@ -24,7 +26,6 @@ export default { }; }, computed: { - ...mapState({ confidential: ({ noteableData }) => noteableData.confidential }), toggleButtonText() { if (this.isLoading) { return __('Applying'); @@ -34,7 +35,7 @@ export default { }, }, methods: { - ...mapActions(['updateConfidentialityOnIssue']), + ...mapActions(['updateConfidentialityOnIssuable']), closeForm() { eventHub.$emit('closeConfidentialityForm'); $(this.$el).trigger('hidden.gl.dropdown'); @@ -43,18 +44,19 @@ export default { this.isLoading = true; const confidential = !this.confidential; - if (this.glFeatures.confidentialApolloSidebar) { - this.updateConfidentialityOnIssue({ confidential, fullPath: this.fullPath }) - .catch(() => { - Flash(__('Something went wrong trying to change the confidentiality of this issue')); - }) - .finally(() => { - this.closeForm(); - this.isLoading = false; - }); - } else { - eventHub.$emit('updateConfidentialAttribute'); - } + this.updateConfidentialityOnIssuable({ confidential, fullPath: this.fullPath }) + .then(() => { + eventHub.$emit('updateIssuableConfidentiality', confidential); + }) + .catch(err => { + Flash( + err || __('Something went wrong trying to change the confidentiality of this issue'), + ); + }) + .finally(() => { + this.closeForm(); + this.isLoading = false; + }); }, }, }; |