diff --git a/keyserver/src/deleters/link-deleters.js b/keyserver/src/deleters/link-deleters.js --- a/keyserver/src/deleters/link-deleters.js +++ b/keyserver/src/deleters/link-deleters.js @@ -6,6 +6,7 @@ import { dbQuery, SQL } from '../database/database.js'; import { checkThreadPermission } from '../fetchers/thread-permission-fetchers.js'; +import { deleteBlob } from '../services/blob.js'; import { Viewer } from '../session/viewer.js'; async function deleteInviteLink( @@ -24,9 +25,16 @@ const query = SQL` DELETE FROM invite_links WHERE name = ${request.name} AND community = ${request.communityID} + RETURNING blob_holder AS blobHolder `; - await dbQuery(query); + const [[row]] = await dbQuery(query); + if (row?.blobHolder) { + await deleteBlob({ + hash: `invite_${request.name}`, + holder: row.blobHolder, + }); + } } export { deleteInviteLink };