Commit e093779a authored by Tom Quirk's avatar Tom Quirk

Fix `canUpdate` console error on external issues

When setting the `canUpdate` provided attribute
in issue_field.vue, we were referencing `this`,
which is undefined at the time when
we "provide" the data.

This commit updates Jira and ZenTao issue
trackers to have `canUpdate` set to false.

It also changes the behavior of issue_field. Now,
we pass a `canEdit` prop to determine when to
make a field editable or not.

Changelog: fixed
EE: true
parent d95a43df
......@@ -13,14 +13,8 @@ export default {
IssueFieldDropdown,
SidebarEditableItem,
},
provide() {
return {
isClassicSidebar: true,
canUpdate: this.canUpdate,
};
},
props: {
canUpdate: {
canEdit: {
type: Boolean,
required: false,
default: false,
......@@ -105,6 +99,7 @@ export default {
ref="editableItem"
:loading="updating"
:title="title"
:can-edit="canEdit"
@open="showDropdown"
>
<template #collapsed>
......@@ -126,7 +121,7 @@ export default {
<template #default>
<issue-field-dropdown
v-if="canUpdate"
v-if="canEdit"
ref="dropdown"
:empty-text="dropdownEmpty"
:items="items"
......
......@@ -136,7 +136,7 @@ export default {
<issue-due-date :due-date="issue.dueDate" />
<issue-field
icon="progress"
:can-update="canUpdateStatus"
:can-edit="canUpdateStatus"
:dropdown-title="$options.i18n.statusDropdownTitle"
:dropdown-empty="$options.i18n.statusDropdownEmpty"
:items="statuses"
......
......@@ -17,6 +17,8 @@ export default function initJiraIssueShow({ mountPointSelector }) {
issueLabelsPath,
issuesShowPath,
issuesListPath,
isClassicSidebar: true,
canUpdate: false,
},
render: (createElement) => createElement(JiraIssuesShowApp),
});
......
......@@ -16,6 +16,8 @@ export default function initZentaoIssueShow({ mountPointSelector }) {
provide: {
issuesShowPath,
issuesListPath,
isClassicSidebar: true,
canUpdate: false,
},
render: (createElement) => createElement(ZentaoIssuesShowApp),
});
......
......@@ -24,6 +24,9 @@ describe('IssueField', () => {
stubs: {
SidebarEditableItem,
},
provide: {
canUpdate: true,
},
});
};
......@@ -94,10 +97,10 @@ describe('IssueField', () => {
});
});
describe('with canUpdate = true', () => {
describe('with canEdit = true', () => {
beforeEach(() => {
createComponent({
props: { canUpdate: true },
props: { canEdit: true },
});
});
......
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