diff options
| author | Mark Felder <feld@FreeBSD.org> | 2020-07-13 13:25:23 -0500 |
|---|---|---|
| committer | Mark Felder <feld@FreeBSD.org> | 2020-07-13 13:25:23 -0500 |
| commit | da94935aaa18f16ac7fbe715c4610427d68ccf72 (patch) | |
| tree | 52691b7cbac2773858b245e596d56c1c5e6ea74b /src/components/attachment/attachment.js | |
| parent | 2eda3d687e8c986a982057c6f5eb969aa8d403d5 (diff) | |
| parent | 3e09a708f600b47dde831eeddb412828b38a0cf4 (diff) | |
Merge branch 'develop' into refactor/notification_settings
Diffstat (limited to 'src/components/attachment/attachment.js')
| -rw-r--r-- | src/components/attachment/attachment.js | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index b832e10f..cb31020d 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-doc' + }, referrerpolicy () { return this.$store.state.instance.mediaProxyAvailable ? '' : 'no-referrer' }, @@ -49,7 +60,15 @@ 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'] + : this.mergedConfig.playVideosInModal + ? ['image', 'video'] + : ['image'] + return modalTypes.includes(this.type) }, ...mapGetters(['mergedConfig']) }, @@ -60,12 +79,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() |
