Merge branch '33904-edit-issue-warning' into 'master'
don't show "Someone edited the issue" warning when saving issue Closes #33904 See merge request !12371
This commit is contained in:
commit
245be4cee9
|
@ -204,13 +204,7 @@ export default {
|
||||||
method: 'getData',
|
method: 'getData',
|
||||||
successCallback: (res) => {
|
successCallback: (res) => {
|
||||||
const data = res.json();
|
const data = res.json();
|
||||||
const shouldUpdate = this.store.stateShouldUpdate(data);
|
|
||||||
|
|
||||||
this.store.updateState(data);
|
this.store.updateState(data);
|
||||||
|
|
||||||
if (this.showForm && (shouldUpdate.title || shouldUpdate.description)) {
|
|
||||||
this.store.formState.lockedWarningVisible = true;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
errorCallback(err) {
|
errorCallback(err) {
|
||||||
throw new Error(err);
|
throw new Error(err);
|
||||||
|
|
|
@ -12,6 +12,10 @@ export default class Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateState(data) {
|
updateState(data) {
|
||||||
|
if (this.stateShouldUpdate(data)) {
|
||||||
|
this.formState.lockedWarningVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
this.state.titleHtml = data.title;
|
this.state.titleHtml = data.title;
|
||||||
this.state.titleText = data.title_text;
|
this.state.titleText = data.title_text;
|
||||||
this.state.descriptionHtml = data.description;
|
this.state.descriptionHtml = data.description;
|
||||||
|
@ -23,10 +27,8 @@ export default class Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
stateShouldUpdate(data) {
|
stateShouldUpdate(data) {
|
||||||
return {
|
return this.state.titleText !== data.title_text ||
|
||||||
title: this.state.titleText !== data.title_text,
|
this.state.descriptionText !== data.description_text;
|
||||||
description: this.state.descriptionText !== data.description_text,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setFormState(state) {
|
setFormState(state) {
|
||||||
|
|
Loading…
Reference in New Issue