feat(tasks): add explicit deletion with DAV tombstones
This commit is contained in:
1 parent
dc978231e2
commit
38a4fcf530
15 files changed
+530
-10
No files matched your search
+20
@@ -130,6 +130,26 @@ window.addEventListener('load', async () => {
|
||||
document.body.dataset.vimReady='true';return;
|
||||
}
|
||||
await wait(()=>$('status').textContent.includes('ありません'));
|
||||
// Deletion shares the archive footer, not a UUID-search workflow.
|
||||
$('new').click();await wait(()=>document.querySelector('#tasks-form [name=title]'));
|
||||
if(!$('delete').hidden)throw Error('Unsaved task must not offer deletion');$('close').click();
|
||||
$('quick-title').value='Disposable deletion fixture';$('capture').requestSubmit();
|
||||
await wait(()=>$('list').querySelector('[data-action=detail]'));$('list').querySelector('[data-action=detail]').click();
|
||||
await wait(()=>!$('delete').hidden);
|
||||
if($('delete').parentElement!==$('archive').parentElement||$('delete').textContent!=='削除')throw Error('Delete action is not beside archive');
|
||||
const deletionID=$('list').querySelector('[data-task-id]').dataset.taskId;
|
||||
window.confirm=()=>false;$('delete').click();
|
||||
if(!$('dialog').open)throw Error('Cancelled deletion closed the editor');
|
||||
const deletionAPI='/_/api/v1/extension/organizer.tasks/items/'+deletionID;
|
||||
const deletionItem=(await fetch(deletionAPI).then(r=>r.json())).item;
|
||||
const changed=await fetch(deletionAPI,{method:'PUT',headers:{'Content-Type':'application/json','If-Match':'"'+deletionItem.version+'"'},body:JSON.stringify({...deletionItem,title:'Updated deletion fixture'})});
|
||||
if(!changed.ok)throw Error('Deletion conflict fixture failed');
|
||||
window.confirm=()=>true;$('delete').click();await wait(()=>$('error').textContent.includes('別の画面'));
|
||||
if(!$('dialog').open||$('delete').disabled)throw Error('Deletion failure did not keep a usable editor');
|
||||
$('close').click();$('refresh').click();await wait(()=>$('list').querySelector('input[name=title]')?.value==='Updated deletion fixture');
|
||||
$('list').querySelector('[data-action=detail]').click();await wait(()=>!$('delete').hidden);$('delete').click();
|
||||
await wait(()=>!$('dialog').open&&!$('list').querySelector('[data-task-id]'));
|
||||
if((await fetch(deletionAPI)).status!==404)throw Error('Deleted task remains readable');
|
||||
$('quick-title').value='Write the first task';$('capture').requestSubmit();
|
||||
await wait(()=>$('list').querySelector('[data-action=detail]'));
|
||||
$('list').querySelector('[data-action=detail]').click();
|
||||
|
||||
Reference in new issue
Block a user