Prevent simultaneous editing of comments and issues (#31053)
fixes #22907
Tested:
- [x] issue content edit
- [x] issue content change tasklist
- [x] pull request content edit
- [x] pull request change tasklist

This commit is contained in:
parent
1ed8e6aa5f
commit
aa92b13164
21 changed files with 172 additions and 27 deletions
|
@ -1,4 +1,5 @@
|
|||
import {POST} from '../modules/fetch.js';
|
||||
import {showErrorToast} from '../modules/toast.js';
|
||||
|
||||
const preventListener = (e) => e.preventDefault();
|
||||
|
||||
|
@ -54,13 +55,20 @@ export function initMarkupTasklist() {
|
|||
const editContentZone = container.querySelector('.edit-content-zone');
|
||||
const updateUrl = editContentZone.getAttribute('data-update-url');
|
||||
const context = editContentZone.getAttribute('data-context');
|
||||
const contentVersion = editContentZone.getAttribute('data-content-version');
|
||||
|
||||
const requestBody = new FormData();
|
||||
requestBody.append('ignore_attachments', 'true');
|
||||
requestBody.append('content', newContent);
|
||||
requestBody.append('context', context);
|
||||
await POST(updateUrl, {data: requestBody});
|
||||
|
||||
requestBody.append('content_version', contentVersion);
|
||||
const response = await POST(updateUrl, {data: requestBody});
|
||||
const data = await response.json();
|
||||
if (response.status === 400) {
|
||||
showErrorToast(data.errorMessage);
|
||||
return;
|
||||
}
|
||||
editContentZone.setAttribute('data-content-version', data.contentVersion);
|
||||
rawContent.textContent = newContent;
|
||||
} catch (err) {
|
||||
checkbox.checked = !checkbox.checked;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue