aboutsummaryrefslogtreecommitdiff
path: root/src/components/gallery/gallery.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2021-06-18 16:11:16 +0300
committerHenry Jameson <me@hjkos.com>2021-06-18 16:11:16 +0300
commit8bab8658e8efd5b8b9f8de9311432c814fa2ef9c (patch)
tree2d54379462fcc908f84d9c0a3d4c7ba64aaa6a6c /src/components/gallery/gallery.js
parentbfe31e20eaddaa9435c98962c53c35f4184ed5fe (diff)
better handling of unknown files, better upload display
Diffstat (limited to 'src/components/gallery/gallery.js')
-rw-r--r--src/components/gallery/gallery.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/components/gallery/gallery.js b/src/components/gallery/gallery.js
index ab13f698..741f1de2 100644
--- a/src/components/gallery/gallery.js
+++ b/src/components/gallery/gallery.js
@@ -38,6 +38,13 @@ const Gallery = {
if (attachment.mimetype.includes('audio')) {
return [...acc, { audio: true, items: [attachment] }, { items: [] }]
}
+ if (!(
+ attachment.mimetype.includes('image') ||
+ attachment.mimetype.includes('video') ||
+ attachment.mimetype.includes('flash')
+ )) {
+ return [...acc, { minimal: true, items: [attachment] }, { items: [] }]
+ }
const maxPerRow = this.maxPerRow || 3
const attachmentsRemaining = this.attachments.length - i + 1
const currentRow = acc[acc.length - 1].items
@@ -52,7 +59,15 @@ const Gallery = {
},
attachmentsDimensionalScore () {
return this.rows.reduce((acc, row) => {
- return acc + (row.audio ? 0.25 : (1 / (row.items.length + 0.6)))
+ let size = 0
+ if (row.minimal) {
+ size += 1 / 8
+ } else if (row.audio) {
+ size += 1 / 4
+ } else {
+ size += 1 / (row.items.length + 0.6)
+ }
+ return acc + size
}, 0)
},
tooManyAttachments () {