diff --git a/packages/storage/src/index.ts b/packages/storage/src/index.ts index 5d3744fdc5..01fa3e72e2 100644 --- a/packages/storage/src/index.ts +++ b/packages/storage/src/index.ts @@ -176,11 +176,11 @@ export function createDummyStorageAdapter (): StorageAdapter { export async function removeAllObjects ( ctx: MeasureContext, storage: StorageAdapter, - workspaceId: WorkspaceId, - prefix?: string + workspaceId: WorkspaceId ): Promise { + ctx.warn('removing all objects from workspace', { workspaceId }) // We need to list all files and delete them - const iterator = await storage.listStream(ctx, workspaceId, prefix) + const iterator = await storage.listStream(ctx, workspaceId) let bulk: string[] = [] while (true) { const obj = await iterator.next() diff --git a/server-plugins/contact-resources/src/index.ts b/server-plugins/contact-resources/src/index.ts index 864f8188aa..805ee180b9 100644 --- a/server-plugins/contact-resources/src/index.ts +++ b/server-plugins/contact-resources/src/index.ts @@ -47,7 +47,7 @@ import core, { } from '@hcengineering/core' import notification, { Collaborators } from '@hcengineering/notification' import { getMetadata } from '@hcengineering/platform' -import serverCore, { TriggerControl, removeAllObjects } from '@hcengineering/server-core' +import serverCore, { TriggerControl } from '@hcengineering/server-core' import { workbenchId } from '@hcengineering/workbench' export async function OnSpaceTypeMembers (tx: Tx, control: TriggerControl): Promise { @@ -181,12 +181,6 @@ export async function OnContactDelete ( return [] } - if (removeContact.avatar == null) { - return [] - } - - await removeAllObjects(ctx, storageAdapter, workspace, removeContact.avatar) - const result: Tx[] = [] const members = await findAll(contact.class.Member, { contact: removeContact._id }) diff --git a/server/front/src/index.ts b/server/front/src/index.ts index 8d61432408..028e8fa87e 100644 --- a/server/front/src/index.ts +++ b/server/front/src/index.ts @@ -17,7 +17,7 @@ import { Analytics } from '@hcengineering/analytics' import { MeasureContext, Blob as PlatformBlob, WorkspaceId, metricsAggregate, type Ref } from '@hcengineering/core' import { Token, decodeToken } from '@hcengineering/server-token' -import { StorageAdapter, removeAllObjects } from '@hcengineering/storage' +import { StorageAdapter } from '@hcengineering/storage' import bp from 'body-parser' import cors from 'cors' import express, { Request, Response } from 'express' @@ -547,10 +547,6 @@ export function start ( // TODO: We need to allow delete only of user attached documents. (https://front.hc.engineering/workbench/platform/tracker/TSK-1081) await config.storageAdapter.remove(ctx, payload.workspace, [uuid]) - // TODO: Add support for related documents. - // TODO: Move support of image resize/format change to separate place. - await removeAllObjects(ctx, config.storageAdapter, payload.workspace, uuid) - res.status(200).send() } catch (error: any) { Analytics.handleError(error)