Skip to content
Snippets Groups Projects
Unverified Commit 83306d24 authored by Brett Walker's avatar Brett Walker Committed by Fatih Acet
Browse files

Pass tasklist lock version

receive data on when there is a conflict
parent f1acd505
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -326,6 +326,7 @@ export default {
:task-status="state.taskStatus"
:issuable-type="issuableType"
:update-url="updateEndpoint"
:lock-version="state.lock_version"
/>
<edited-component
v-if="hasUpdated"
Loading
Loading
Loading
Loading
@@ -35,6 +35,10 @@ export default {
required: false,
default: null,
},
lockVersion: {
type: Number,
required: false,
},
},
data() {
return {
Loading
Loading
@@ -67,8 +71,10 @@ export default {
new TaskList({
dataType: this.issuableType,
fieldName: 'description',
lockVersion: this.lockVersion,
selector: '.detail-page-description',
onSuccess: this.taskListUpdateSuccess.bind(this),
onError: this.taskListUpdateError.bind(this),
});
}
},
Loading
Loading
@@ -82,6 +88,10 @@ export default {
}
},
 
taskListUpdateError(data) {
// stub for error handling
},
updateTaskStatusText() {
const taskRegexMatches = this.taskStatus.match(/(\d+) of ((?!0)\d+)/);
const $issuableHeader = $('.issuable-meta');
Loading
Loading
Loading
Loading
@@ -8,8 +8,9 @@ export default class TaskList {
this.selector = options.selector;
this.dataType = options.dataType;
this.fieldName = options.fieldName;
this.lockVersion = options.lockVersion;
this.onSuccess = options.onSuccess || (() => {});
this.onError = function showFlash(e) {
this.onError = options.onError || function showFlash(e) {
let errorMessages = '';
 
if (e.response.data && typeof e.response.data === 'object') {
Loading
Loading
@@ -43,6 +44,7 @@ export default class TaskList {
const patchData = {};
patchData[this.dataType] = {
[this.fieldName]: $target.val(),
['lock_version']: this.lockVersion,
};
 
return axios
Loading
Loading
Loading
Loading
@@ -162,10 +162,13 @@ module IssuableActions
end
 
format.json do
# We want to pass back the latest valid data, so reload the model
@issuable.reload
render json: {
errors: [
"Someone edited this #{issuable.human_class_name} at the same time you did. Please refresh your browser and make sure your changes will not unintentionally remove theirs."
]
],
data: serializer.represent(@issuable)
}, status: :conflict
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment