attachment: fix over reliance on fileType()

Signed-off-by: Yonle <yonle@proton.me>
This commit is contained in:
Yonle 2026-02-27 04:12:47 +07:00
commit 38444f3165
No known key found for this signature in database
GPG key ID: 11889F326F523287
10 changed files with 41 additions and 63 deletions

View file

@ -4,6 +4,8 @@ import Attachment from '../attachment/attachment.vue'
import { useMediaViewerStore } from 'src/stores/media_viewer.js'
const displayTypes = ["image", "video", "flash"]
const Gallery = {
props: [
'attachments',
@ -45,20 +47,14 @@ const Gallery = {
: attachments
.reduce(
(acc, attachment, i) => {
if (attachment.mimetype.includes('audio')) {
if (attachment.type == 'audio') {
return [
...acc,
{ audio: true, items: [attachment] },
{ items: [] },
]
}
if (
!(
attachment.mimetype.includes('image') ||
attachment.mimetype.includes('video') ||
attachment.mimetype.includes('flash')
)
) {
if (!displayTypes.includes(attachment.type)) {
return [
...acc,
{ minimal: true, items: [attachment] },