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'; ...@@ -4,7 +4,7 @@ import { mapActions, mapGetters, mapState } from 'vuex';
import createFlash, { FLASH_TYPES } from '~/flash'; import createFlash, { FLASH_TYPES } from '~/flash';
import { EVENT_ISSUABLE_VUE_APP_CHANGE } from '~/issuable/constants'; import { EVENT_ISSUABLE_VUE_APP_CHANGE } from '~/issuable/constants';
import { IssuableType } from '~/issuable_show/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 { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
import { visitUrl } from '~/lib/utils/url_utility'; import { visitUrl } from '~/lib/utils/url_utility';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
...@@ -38,6 +38,9 @@ export default { ...@@ -38,6 +38,9 @@ export default {
canCreateIssue: { canCreateIssue: {
default: false, default: false,
}, },
canCreateIncident: {
default: false,
},
canPromoteToEpic: { canPromoteToEpic: {
default: false, default: false,
}, },
...@@ -83,6 +86,12 @@ export default { ...@@ -83,6 +86,12 @@ export default {
? sprintf(__('Reopen %{issueType}'), { issueType: this.issueType }) ? sprintf(__('Reopen %{issueType}'), { issueType: this.issueType })
: sprintf(__('Close %{issueType}'), { issueType: this.issueType }); : sprintf(__('Close %{issueType}'), { issueType: this.issueType });
}, },
canCreateNewIssueType() {
if (this.issueType === IncidentType && !this.canCreateIncident) {
return false;
}
return this.canCreateIssue;
},
qaSelector() { qaSelector() {
return this.isClosed ? 'reopen_issue_button' : 'close_issue_button'; return this.isClosed ? 'reopen_issue_button' : 'close_issue_button';
}, },
...@@ -202,7 +211,7 @@ export default { ...@@ -202,7 +211,7 @@ export default {
> >
{{ buttonText }} {{ buttonText }}
</gl-dropdown-item> </gl-dropdown-item>
<gl-dropdown-item v-if="canCreateIssue" :href="newIssuePath"> <gl-dropdown-item v-if="canCreateNewIssueType" :href="newIssuePath">
{{ newIssueTypeText }} {{ newIssueTypeText }}
</gl-dropdown-item> </gl-dropdown-item>
<gl-dropdown-item v-if="canPromoteToEpic" @click="promoteToEpic"> <gl-dropdown-item v-if="canPromoteToEpic" @click="promoteToEpic">
...@@ -240,7 +249,7 @@ export default { ...@@ -240,7 +249,7 @@ export default {
no-caret no-caret
right right
> >
<gl-dropdown-item v-if="canCreateIssue" :href="newIssuePath"> <gl-dropdown-item v-if="canCreateNewIssueType" :href="newIssuePath">
{{ newIssueTypeText }} {{ newIssueTypeText }}
</gl-dropdown-item> </gl-dropdown-item>
<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