Commit 9fc28484 authored by Tristan Read's avatar Tristan Read Committed by Peter Leitzen

Apply permissions check to incident action bar

parent 59ac8e4e
......@@ -4,7 +4,7 @@ import { mapActions, mapGetters, mapState } from 'vuex';
import createFlash, { FLASH_TYPES } from '~/flash';
import { EVENT_ISSUABLE_VUE_APP_CHANGE } from '~/issuable/constants';
import { IssuableType } from '~/issuable_show/constants';
import { IssuableStatus, IssueStateEvent } from '~/issue_show/constants';
import { IssuableStatus, IssueStateEvent, IncidentType } from '~/issue_show/constants';
import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
import { visitUrl } from '~/lib/utils/url_utility';
import { __, sprintf } from '~/locale';
......@@ -38,6 +38,9 @@ export default {
canCreateIssue: {
default: false,
},
canCreateIncident: {
default: false,
},
canPromoteToEpic: {
default: false,
},
......@@ -83,6 +86,12 @@ export default {
? sprintf(__('Reopen %{issueType}'), { issueType: this.issueType })
: sprintf(__('Close %{issueType}'), { issueType: this.issueType });
},
canCreateNewIssueType() {
if (this.issueType === IncidentType && !this.canCreateIncident) {
return false;
}
return this.canCreateIssue;
},
qaSelector() {
return this.isClosed ? 'reopen_issue_button' : 'close_issue_button';
},
......@@ -202,7 +211,7 @@ export default {
>
{{ buttonText }}
</gl-dropdown-item>
<gl-dropdown-item v-if="canCreateIssue" :href="newIssuePath">
<gl-dropdown-item v-if="canCreateNewIssueType" :href="newIssuePath">
{{ newIssueTypeText }}
</gl-dropdown-item>
<gl-dropdown-item v-if="canPromoteToEpic" @click="promoteToEpic">
......@@ -240,7 +249,7 @@ export default {
no-caret
right
>
<gl-dropdown-item v-if="canCreateIssue" :href="newIssuePath">
<gl-dropdown-item v-if="canCreateNewIssueType" :href="newIssuePath">
{{ newIssueTypeText }}
</gl-dropdown-item>
<gl-dropdown-item
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment