From 96d2c86d3bc1c26da2ca46ec04fb27a9de348e47 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Mon, 29 Jun 2020 14:48:22 +0300 Subject: change placeholders to use descriptions, use icons with placeholders, change uploads to use attachment component --- src/components/attachment/attachment.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/components/attachment/attachment.js') diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index b832e10f..561a5a98 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -8,7 +8,6 @@ const Attachment = { props: [ 'attachment', 'nsfw', - 'statusId', 'size', 'allowPlay', 'setMedia', @@ -30,9 +29,21 @@ const Attachment = { VideoAttachment }, computed: { - usePlaceHolder () { + usePlaceholder () { return this.size === 'hide' || this.type === 'unknown' }, + placeholderName () { + if (this.attachment.description === '' || !this.attachment.description) { + return this.type.toUpperCase() + } + return this.attachment.description + }, + placeholderIconClass () { + if (this.type === 'image') return 'icon-picture' + if (this.type === 'video') return 'icon-video' + if (this.type === 'audio') return 'icon-music' + return 'icon-link' + }, referrerpolicy () { return this.$store.state.instance.mediaProxyAvailable ? '' : 'no-referrer' }, @@ -51,6 +62,12 @@ const Attachment = { fullwidth () { return this.type === 'html' || this.type === 'audio' }, + useModal () { + return this.size === 'hide' ? ['image', 'video', 'audio'] + : this.mergedConfig.playVideosInModal + ? ['image', 'video'] + : ['image'] + }, ...mapGetters(['mergedConfig']) }, methods: { @@ -60,12 +77,7 @@ const Attachment = { } }, openModal (event) { - const modalTypes = this.mergedConfig.playVideosInModal - ? ['image', 'video'] - : ['image'] - if (fileTypeService.fileMatchesSomeType(modalTypes, this.attachment) || - this.usePlaceHolder - ) { + if (this.useModal) { event.stopPropagation() event.preventDefault() this.setMedia() -- cgit v1.2.3-70-g09d2 From 4d25be7cb35f86ba2abe883116dc6442c93a1d9d Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Mon, 6 Jul 2020 13:42:33 +0300 Subject: fix modal types check being broken --- src/components/attachment/attachment.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/components/attachment/attachment.js') diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index 561a5a98..fe28e5f3 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -63,10 +63,11 @@ const Attachment = { return this.type === 'html' || this.type === 'audio' }, useModal () { - return this.size === 'hide' ? ['image', 'video', 'audio'] + const modalTypes = this.size === 'hide' ? ['image', 'video', 'audio'] : this.mergedConfig.playVideosInModal ? ['image', 'video'] : ['image'] + return modalTypes.includes(this.type) }, ...mapGetters(['mergedConfig']) }, -- cgit v1.2.3-70-g09d2 From d55c09df1844bf8fc99b7a3414cbd71ae2c8bad3 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Mon, 6 Jul 2020 15:06:13 +0300 Subject: fix edge case of videos and unknown files together --- src/components/attachment/attachment.js | 3 ++- src/components/attachment/attachment.vue | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/components/attachment/attachment.js') diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index 23af693f..cb31020d 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -60,7 +60,8 @@ const Attachment = { return this.size === 'small' }, fullwidth () { - return this.type === 'html' || this.type === 'audio' + if (this.size === 'hide') return false + return this.type === 'html' || this.type === 'audio' || this.type === 'unknown' }, useModal () { const modalTypes = this.size === 'hide' ? ['image', 'video', 'audio'] diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index a18bf186..be7377e9 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -1,6 +1,7 @@