Change computed to mediaAttachments in toot

This commit is contained in:
AkiraFukushima 2019-01-23 23:38:07 +09:00
parent ef20849dea
commit 47d25b921c
1 changed files with 7 additions and 7 deletions

View File

@ -53,8 +53,8 @@
<el-button v-show="sensitive() && isShowAttachments()" class="hide-sensitive" type="text" @click="showAttachments = false" :title="$t('cards.toot.hide')"> <el-button v-show="sensitive() && isShowAttachments()" class="hide-sensitive" type="text" @click="showAttachments = false" :title="$t('cards.toot.hide')">
<icon name="eye" class="hide"></icon> <icon name="eye" class="hide"></icon>
</el-button> </el-button>
<div class="media" v-bind:key="media.preview_url" v-for="media in mediaAttachments()"> <div class="media" v-bind:key="media.preview_url" v-for="media in mediaAttachments">
<FailoverImg :src="media.preview_url" @click="openImage(media.url, mediaAttachments())" :title="media.description" /> <FailoverImg :src="media.preview_url" @click="openImage(media.url, mediaAttachments)" :title="media.description" />
<el-tag class="media-label" size="mini" v-if="media.type == 'gifv'">GIF</el-tag> <el-tag class="media-label" size="mini" v-if="media.type == 'gifv'">GIF</el-tag>
<el-tag class="media-label" size="mini" v-else-if="media.type == 'video'">VIDEO</el-tag> <el-tag class="media-label" size="mini" v-else-if="media.type == 'video'">VIDEO</el-tag>
</div> </div>
@ -205,6 +205,9 @@ export default {
} else { } else {
return this.message return this.message
} }
},
mediaAttachments: function () {
return this.originalMessage.media_attachments
} }
}, },
mounted () { mounted () {
@ -395,9 +398,6 @@ export default {
this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/changeAccount', account) this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/changeAccount', account)
this.$store.commit('TimelineSpace/Contents/SideBar/changeOpenSideBar', true) this.$store.commit('TimelineSpace/Contents/SideBar/changeOpenSideBar', true)
}, },
mediaAttachments () {
return this.originalMessage.media_attachments
},
reblogsCount () { reblogsCount () {
if (this.originalMessage.reblogs_count > 0) { if (this.originalMessage.reblogs_count > 0) {
return this.originalMessage.reblogs_count return this.originalMessage.reblogs_count
@ -440,7 +440,7 @@ export default {
return !this.spoilered() || this.showContent return !this.spoilered() || this.showContent
}, },
sensitive () { sensitive () {
return this.originalMessage.sensitive && this.mediaAttachments().length > 0 return this.originalMessage.sensitive && this.mediaAttachments.length > 0
}, },
isShowAttachments () { isShowAttachments () {
return !this.sensitive() || this.showAttachments return !this.sensitive() || this.showAttachments
@ -492,7 +492,7 @@ export default {
this.openUser(this.originalMessage.account) this.openUser(this.originalMessage.account)
break break
case 'image': case 'image':
const images = this.mediaAttachments() const images = this.mediaAttachments
if (images.length === 0) { if (images.length === 0) {
return 0 return 0
} }