diff options
Diffstat (limited to 'src/components/status_content')
| -rw-r--r-- | src/components/status_content/status_content.js | 26 | ||||
| -rw-r--r-- | src/components/status_content/status_content.vue | 38 |
2 files changed, 16 insertions, 48 deletions
diff --git a/src/components/status_content/status_content.js b/src/components/status_content/status_content.js index 1b80ee09..184f2783 100644 --- a/src/components/status_content/status_content.js +++ b/src/components/status_content/status_content.js @@ -3,7 +3,6 @@ import Poll from '../poll/poll.vue' import Gallery from '../gallery/gallery.vue' import StatusBody from 'src/components/status_body/status_body.vue' import LinkPreview from '../link-preview/link-preview.vue' -import fileType from 'src/services/file_type/file_type.service' import { mapGetters, mapState } from 'vuex' import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -28,6 +27,7 @@ const StatusContent = { name: 'StatusContent', props: [ 'status', + 'compact', 'focused', 'noHeading', 'fullContent', @@ -57,24 +57,6 @@ const StatusContent = { } return 'normal' }, - galleryTypes () { - if (this.attachmentSize === 'hide') { - return [] - } - return this.mergedConfig.playVideosInModal - ? ['image', 'video'] - : ['image'] - }, - galleryAttachments () { - return this.status.attachments.filter( - file => fileType.fileMatchesSomeType(this.galleryTypes, file) - ) - }, - nonGalleryAttachments () { - return this.status.attachments.filter( - file => !fileType.fileMatchesSomeType(this.galleryTypes, file) - ) - }, maxThumbnails () { return this.mergedConfig.maxThumbnails }, @@ -89,12 +71,6 @@ const StatusContent = { Gallery, LinkPreview, StatusBody - }, - methods: { - setMedia () { - const attachments = this.attachmentSize === 'hide' ? this.status.attachments : this.galleryAttachments - return () => this.$store.dispatch('setMedia', attachments) - } } } diff --git a/src/components/status_content/status_content.vue b/src/components/status_content/status_content.vue index 5cebc697..9db176f0 100644 --- a/src/components/status_content/status_content.vue +++ b/src/components/status_content/status_content.vue @@ -1,8 +1,12 @@ <template> - <div class="StatusContent"> + <div + class="StatusContent" + :class="{ '-compact': compact }" + > <slot name="header" /> <StatusBody :status="status" + :compact="compact" :single-line="singleLine" @parseReady="$emit('parseReady', $event)" > @@ -13,32 +17,20 @@ /> </div> - <div + <gallery v-if="status.attachments.length !== 0" class="attachments media-body" - > - <attachment - v-for="attachment in nonGalleryAttachments" - :key="attachment.id" - class="non-gallery" - :size="attachmentSize" - :nsfw="nsfwClickthrough" - :attachment="attachment" - :allow-play="true" - :set-media="setMedia()" - @play="$emit('mediaplay', attachment.id)" - @pause="$emit('mediapause', attachment.id)" - /> - <gallery - v-if="galleryAttachments.length > 0" - :nsfw="nsfwClickthrough" - :attachments="galleryAttachments" - :set-media="setMedia()" - /> - </div> + :nsfw="nsfwClickthrough" + :attachments="status.attachments" + :limit="compact ? 1 : 0" + :size="attachmentSize" + @setMedia="onMedia" + @play="$emit('mediaplay', attachment.id)" + @pause="$emit('mediapause', attachment.id)" + /> <div - v-if="status.card && !noHeading" + v-if="status.card && !noHeading && !compact" class="link-preview media-body" > <link-preview |
