feat: attachment preview
Signed-off-by: Sebastian <krupinski01@gmail.com>
This commit is contained in:
+16
-1
@@ -5,7 +5,7 @@ import { useEntitiesStore } from '@MailManager/stores/entitiesStore'
|
||||
import { useServicesStore } from '@MailManager/stores/servicesStore'
|
||||
import { useMailSync } from '@MailManager/composables/useMailSync'
|
||||
import type { ServiceIdentifier, CollectionIdentifier, EntityIdentifier } from '@MailManager/types/common'
|
||||
import type { EntityTransmitRequest } from '@MailManager/types/entity'
|
||||
import type { EntityTransmitRequest, EntityBlobSelector } from '@MailManager/types/entity'
|
||||
import type { MessageAddressInterface, MessageInterface, MessagePartInterface } from '@MailManager/types/message'
|
||||
import { ServiceObject, type CollectionObject, type EntityObject } from '@MailManager/models'
|
||||
import { CollectionPropertiesObject } from '@MailManager/models/collection'
|
||||
@@ -571,6 +571,20 @@ export const useMailStore = defineStore('mailStore', () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function attachmentBlob(entity: EntityObject, part: MessagePartInterface): Promise<Blob> {
|
||||
const selector: EntityBlobSelector = {
|
||||
blobId: part.blobId ?? undefined,
|
||||
partId: part.partId ?? undefined,
|
||||
cid: part.cid ?? undefined,
|
||||
}
|
||||
const results = await entitiesStore.blobs(entity.identifier, [selector])
|
||||
const blob = results[0]?.blob
|
||||
if (!blob) {
|
||||
throw new Error('Attachment content unavailable')
|
||||
}
|
||||
return blob
|
||||
}
|
||||
|
||||
// ── Exports ───────────────────────────────────────────────────────────────
|
||||
|
||||
return {
|
||||
@@ -607,6 +621,7 @@ export const useMailStore = defineStore('mailStore', () => {
|
||||
deleteFolder,
|
||||
moveMessages,
|
||||
downloadMessage,
|
||||
attachmentBlob,
|
||||
moveFolder,
|
||||
renameFolder,
|
||||
isServiceFolderLoading,
|
||||
|
||||
Reference in New Issue
Block a user