Skip to content

Commit

Permalink
Don't store version on delete
Browse files Browse the repository at this point in the history
  • Loading branch information
bosschaert committed Dec 4, 2024
1 parent 41f272d commit 092088c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
11 changes: 6 additions & 5 deletions src/storage/object/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ async function invalidateCollab(api, url, env) {
}

export async function deleteObject(client, daCtx, Key, env, isMove = false) {

Check failure on line 29 in src/storage/object/delete.js

View workflow job for this annotation

GitHub Actions / Running tests (20.x)

'isMove' is assigned a value but never used. Allowed unused vars must match /^_$/u
const fname = Key.split('/').pop();
// const fname = Key.split('/').pop();

if (fname.includes('.') && !fname.startsWith('.') && !fname.endsWith('.props')) {
const tmpCtx = { ...daCtx, key: Key }; // For next calls, ctx needs the passed
await postObjectVersionWithLabel(isMove ? 'Moved' : 'Deleted', env, tmpCtx);
}
// if (fname.includes('.') && !fname.startsWith('.') && !fname.endsWith('.props')) {
// const tmpCtx = { ...daCtx, key: Key }; // For next calls, ctx needs the passed
// note the Ext also needs to be set ^^^
// await postObjectVersionWithLabel(isMove ? 'Moved' : 'Deleted', env, tmpCtx);
// }

let resp;
try {
Expand Down
12 changes: 6 additions & 6 deletions test/storage/object/delete.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ describe('Object delete', () => {

const resp = await deleteObject(client, daCtx, 'foo/bar.html', env);
assert.equal(204, resp.status);
assert.deepStrictEqual(['postObjectVersionWithLabel'], postObjVerCalled);
assert.deepStrictEqual(
['https://localhost/api/v1/deleteadmin?doc=https://admin.da.live/source/testorg/foo/bar.html'],
collabCalled
);
// assert.deepStrictEqual(['postObjectVersionWithLabel'], postObjVerCalled);
// assert.deepStrictEqual(
// ['https://localhost/api/v1/deleteadmin?doc=https://admin.da.live/source/testorg/foo/bar.html'],
// collabCalled
// );
} finally {
globalThis.fetch = savedFetch;
}
Expand Down Expand Up @@ -219,7 +219,7 @@ describe('Object delete', () => {

const resp = await deleteObject(client, daCtx, 'aha.png', env, true);
assert.equal(204, resp.status);
assert.deepStrictEqual(['postObjectVersionWithLabel'], postObjVerCalled);
// assert.deepStrictEqual(['postObjectVersionWithLabel'], postObjVerCalled);
} finally {
globalThis.fetch = savedFetch;
}
Expand Down

0 comments on commit 092088c

Please sign in to comment.