mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-29 04:55:03 +02:00
UBERF-9429: Provide workspace ids to storage adapters (#7956)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
@@ -37,8 +37,7 @@ import core, {
|
||||
TxRemoveDoc,
|
||||
TxUpdateDoc,
|
||||
Type,
|
||||
type MeasureContext,
|
||||
type WorkspaceDataId
|
||||
type MeasureContext
|
||||
} from '@hcengineering/core'
|
||||
import notification, { CommonInboxNotification, MentionInboxNotification } from '@hcengineering/notification'
|
||||
import { StorageAdapter, TriggerControl } from '@hcengineering/server-core'
|
||||
@@ -402,8 +401,7 @@ async function getCreateReferencesTxes (
|
||||
const blobId = (createdDoc as any)[attr.name] as Ref<Blob>
|
||||
if (blobId != null) {
|
||||
try {
|
||||
const dataId = control.workspace.dataId ?? (control.workspace.uuid as unknown as WorkspaceDataId)
|
||||
const buffer = await storage.read(ctx, dataId, blobId)
|
||||
const buffer = await storage.read(ctx, control.workspace, blobId)
|
||||
const markup = Buffer.concat(buffer as any).toString()
|
||||
const attrReferences = getReferencesData(srcDocId, srcDocClass, attachedDocId, attachedDocClass, markup)
|
||||
refs.push(...attrReferences)
|
||||
@@ -450,8 +448,7 @@ async function getUpdateReferencesTxes (
|
||||
try {
|
||||
const blobId = (updatedDoc as any)[attr.name] as Ref<Blob>
|
||||
if (blobId != null) {
|
||||
const dataId = control.workspace.dataId ?? (control.workspace.uuid as unknown as WorkspaceDataId)
|
||||
const buffer = await storage.read(ctx, dataId, blobId)
|
||||
const buffer = await storage.read(ctx, control.workspace, blobId)
|
||||
const markup = Buffer.concat(buffer as any).toString()
|
||||
const attrReferences = getReferencesData(srcDocId, srcDocClass, attachedDocId, attachedDocClass, markup)
|
||||
references.push(...attrReferences)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
//
|
||||
|
||||
import attachment, { type Attachment } from '@hcengineering/attachment'
|
||||
import type { Tx, TxRemoveDoc, WorkspaceDataId } from '@hcengineering/core'
|
||||
import type { Tx, TxRemoveDoc } from '@hcengineering/core'
|
||||
import type { TriggerControl } from '@hcengineering/server-core'
|
||||
|
||||
/**
|
||||
@@ -45,8 +45,7 @@ export async function OnAttachmentDelete (
|
||||
}
|
||||
}
|
||||
if (toDelete.length > 0) {
|
||||
const dataId = workspace.dataId ?? (workspace.uuid as unknown as WorkspaceDataId)
|
||||
await storageAdapter.remove(ctx, dataId, toDelete)
|
||||
await storageAdapter.remove(ctx, workspace, toDelete)
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { CollaborativeDoc, Doc, Tx, TxRemoveDoc, WorkspaceDataId } from '@hcengineering/core'
|
||||
import type { CollaborativeDoc, Doc, Tx, TxRemoveDoc } from '@hcengineering/core'
|
||||
import core, { makeCollabId, makeCollabYdocId } from '@hcengineering/core'
|
||||
import { type TriggerControl } from '@hcengineering/server-core'
|
||||
|
||||
@@ -49,8 +49,7 @@ export async function OnDelete (
|
||||
const toRemove: string[] = toDelete.map(makeCollabYdocId)
|
||||
if (toRemove.length > 0) {
|
||||
await ctx.with('remove', {}, async () => {
|
||||
const dataId = workspace.dataId ?? (workspace.uuid as unknown as WorkspaceDataId)
|
||||
await storageAdapter.remove(ctx, dataId, toRemove)
|
||||
await storageAdapter.remove(ctx, workspace, toRemove)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ import {
|
||||
type TxRemoveDoc,
|
||||
DocumentQuery,
|
||||
FindOptions,
|
||||
FindResult,
|
||||
type WorkspaceDataId
|
||||
FindResult
|
||||
} from '@hcengineering/core'
|
||||
import drive, { type FileVersion, type Folder } from '@hcengineering/drive'
|
||||
import type { TriggerControl } from '@hcengineering/server-core'
|
||||
@@ -45,8 +44,7 @@ export async function OnFileVersionDelete (
|
||||
}
|
||||
}
|
||||
if (toDelete.length > 0) {
|
||||
const dataId = workspace.dataId ?? (workspace.uuid as unknown as WorkspaceDataId)
|
||||
await storageAdapter.remove(ctx, dataId, toDelete)
|
||||
await storageAdapter.remove(ctx, workspace, toDelete)
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
@@ -25,8 +25,7 @@ import {
|
||||
Ref,
|
||||
Tx,
|
||||
TxCreateDoc,
|
||||
TxProcessor,
|
||||
type WorkspaceDataId
|
||||
TxProcessor
|
||||
} from '@hcengineering/core'
|
||||
import notification, {
|
||||
ActivityInboxNotification,
|
||||
@@ -179,8 +178,7 @@ export async function createPushNotification (
|
||||
const provider = getAvatarProviderId(senderAvatar.avatarType)
|
||||
if (provider === contact.avatarProvider.Image) {
|
||||
if (senderAvatar.avatar != null) {
|
||||
const dataId = control.workspace.dataId ?? (control.workspace.uuid as unknown as WorkspaceDataId)
|
||||
const url = await control.storageAdapter.getUrl(control.ctx, dataId, senderAvatar.avatar)
|
||||
const url = await control.storageAdapter.getUrl(control.ctx, control.workspace, senderAvatar.avatar)
|
||||
data.icon = url.includes('://') ? url : concatLink(front, url)
|
||||
}
|
||||
} else if (provider === contact.avatarProvider.Gravatar && senderAvatar.avatarProps?.url !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user