Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33338726
D13768.1768913140.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D13768.1768913140.diff
View Options
diff --git a/keyserver/src/database/migration-config.js b/keyserver/src/database/migration-config.js
--- a/keyserver/src/database/migration-config.js
+++ b/keyserver/src/database/migration-config.js
@@ -6,6 +6,8 @@
import genesis from 'lib/facts/genesis.js';
import { policyTypes } from 'lib/facts/policies.js';
import { specialRoles } from 'lib/permissions/special-roles.js';
+import { inviteLinkBlobHash } from 'lib/shared/invite-links.js';
+import type { InviteLinkWithHolder } from 'lib/types/link-types.js';
import { messageTypes } from 'lib/types/message-types-enum.js';
import {
threadPermissions,
@@ -22,6 +24,8 @@
import { dbQuery, SQL } from '../database/database.js';
import { processMessagesInDBForSearch } from '../database/search-utils.js';
import { deleteThread } from '../deleters/thread-deleters.js';
+import { fetchAllPrimaryInviteLinks } from '../fetchers/link-fetchers.js';
+import { deleteBlob } from '../services/blob.js';
import { createScriptViewer } from '../session/scripts.js';
import { fetchOlmAccount } from '../updaters/olm-account-updater.js';
import { updateChangedUndirectedRelationships } from '../updaters/relationship-updaters.js';
@@ -1052,6 +1056,34 @@
},
migrationType: 'wrap_in_transaction_and_block_requests',
},
+ {
+ version: 71,
+ migrationPromise: async () => {
+ const links = await fetchAllPrimaryInviteLinks();
+ const promises = [];
+ for (const link: InviteLinkWithHolder of links) {
+ const holder = link.blobHolder;
+ if (!holder) {
+ continue;
+ }
+ promises.push(
+ deleteBlob(
+ {
+ hash: inviteLinkBlobHash(inviteLinkBlobHash(link.name)),
+ holder,
+ },
+ true,
+ ),
+ );
+ }
+ try {
+ await Promise.all(promises);
+ } catch (e) {
+ console.log('Error while cleaning invite links blobs', e);
+ }
+ },
+ migrationType: 'run_simultaneously_with_requests',
+ },
];
const versions: $ReadOnlyArray<number> = migrations.map(
migration => migration.version,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 20, 12:45 PM (15 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5960828
Default Alt Text
D13768.1768913140.diff (2 KB)
Attached To
Mode
D13768: [keyserver] Delete invalid invite links
Attached
Detach File
Event Timeline
Log In to Comment