From ef20849dea2a0a8fb41d33b4f9615ca69ef15bc9 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Wed, 23 Jan 2019 23:35:55 +0900 Subject: [PATCH] Change computed to originalMessage in toot --- src/renderer/components/molecules/Toot.vue | 154 ++++++++++----------- 1 file changed, 77 insertions(+), 77 deletions(-) diff --git a/src/renderer/components/molecules/Toot.vue b/src/renderer/components/molecules/Toot.vue index 815151a8..66810839 100644 --- a/src/renderer/components/molecules/Toot.vue +++ b/src/renderer/components/molecules/Toot.vue @@ -9,52 +9,52 @@ role="article" aria-label="toot" > -
+
Filtered
-
+
-
- - {{ accountName(originalMessage(message).account) }} +
+ + {{ accountName(originalMessage.account) }}
-
-
- - +
+ + {{ $t('cards.toot.show_more') }} {{ $t('cards.toot.hide')}}
-
+
- + {{ $t('cards.toot.sensitive') }} -
- +
+ -
- +
+ GIF VIDEO
@@ -73,7 +73,7 @@
- + @@ -82,17 +82,17 @@ - + - {{ reblogsCount(message) }} + {{ reblogsCount() }} - + - {{ favouritesCount(message) }} + {{ favouritesCount() }} @@ -103,22 +103,22 @@
  • {{ $t('cards.toot.view_toot_detail') }}
  • -
  • +
  • {{ $t('cards.toot.open_in_browser') }}
  • -
  • +
  • {{ $t('cards.toot.copy_link_to_toot') }}
  • -
  • +
  • {{ $t('cards.toot.mute') }}
  • -
  • +
  • {{ $t('cards.toot.block') }}
  • -
  • +
  • {{ $t('cards.toot.report') }}
  • -
  • +
  • {{ $t('cards.toot.delete') }}
  • @@ -128,8 +128,8 @@
    -
    - {{ $t('cards.toot.via', { application: application(message) }) }} +
    + {{ $t('cards.toot.via', { application: application() }) }}
    @@ -193,11 +193,18 @@ export default { return this.focused && !this.overlaid }, timestamp: function () { - return this.parseDatetime(this.originalMessage(this.message).created_at, this.now) + return this.parseDatetime(this.originalMessage.created_at, this.now) }, readableTimestamp: function () { moment.locale(this.language) - return moment(this.originalMessage(this.message).created_at).format('LLLL') + return moment(this.originalMessage.created_at).format('LLLL') + }, + originalMessage: function () { + if (this.message.reblog !== null) { + return this.message.reblog + } else { + return this.message + } } }, mounted () { @@ -225,13 +232,6 @@ export default { } }, methods: { - originalMessage (message) { - if (message.reblog !== null) { - return message.reblog - } else { - return message - } - }, username (account) { switch (this.displayNameStyle) { case DisplayStyle.DisplayNameAndUsername.value: @@ -298,8 +298,8 @@ export default { return shell.openExternal(link) } }, - openReply (message) { - this.$store.dispatch('TimelineSpace/Modals/NewToot/openReply', this.originalMessage(message)) + openReply () { + this.$store.dispatch('TimelineSpace/Modals/NewToot/openReply', this.originalMessage) }, openDetail (message) { this.$store.dispatch('TimelineSpace/Contents/SideBar/openTootComponent') @@ -315,17 +315,17 @@ export default { clipboard.writeText(message.url, 'toot-link') this.$refs.popper.doClose() }, - reportUser (message) { - this.$store.dispatch('TimelineSpace/Modals/Report/openReport', this.originalMessage(message)) + reportUser () { + this.$store.dispatch('TimelineSpace/Modals/Report/openReport', this.originalMessage) this.$refs.popper.doClose() }, - confirmMute (message) { - this.$store.dispatch('TimelineSpace/Modals/MuteConfirm/changeAccount', this.originalMessage(message).account) + confirmMute () { + this.$store.dispatch('TimelineSpace/Modals/MuteConfirm/changeAccount', this.originalMessage.account) this.$store.dispatch('TimelineSpace/Modals/MuteConfirm/changeModal', true) this.$refs.popper.doClose() }, - block (message) { - this.$store.dispatch('molecules/Toot/block', this.originalMessage(message).account) + block () { + this.$store.dispatch('molecules/Toot/block', this.originalMessage.account) this.$refs.popper.doClose() }, changeReblog (message) { @@ -395,23 +395,23 @@ export default { this.$store.dispatch('TimelineSpace/Contents/SideBar/AccountProfile/changeAccount', account) this.$store.commit('TimelineSpace/Contents/SideBar/changeOpenSideBar', true) }, - mediaAttachments (message) { - return this.originalMessage(message).media_attachments + mediaAttachments () { + return this.originalMessage.media_attachments }, - reblogsCount (message) { - if (this.originalMessage(message).reblogs_count > 0) { - return this.originalMessage(message).reblogs_count + reblogsCount () { + if (this.originalMessage.reblogs_count > 0) { + return this.originalMessage.reblogs_count } return '' }, - favouritesCount (message) { - if (this.originalMessage(message).favourites_count > 0) { - return this.originalMessage(message).favourites_count + favouritesCount () { + if (this.originalMessage.favourites_count > 0) { + return this.originalMessage.favourites_count } return '' }, - isMyMessage (message) { - return this.$store.state.TimelineSpace.account.accountId === this.originalMessage(message).account.id + isMyMessage () { + return this.$store.state.TimelineSpace.account.accountId === this.originalMessage.account.id }, deleteToot (message) { this.$store.dispatch('molecules/Toot/deleteToot', message) @@ -425,28 +425,28 @@ export default { }) }) }, - application (message) { - let msg = this.originalMessage(message) + application () { + let msg = this.originalMessage if (msg.application !== undefined && msg.application !== null) { return msg.application.name } return null }, - spoilered (message) { - return this.originalMessage(message).spoiler_text.length > 0 + spoilered () { + return this.originalMessage.spoiler_text.length > 0 }, - isShowContent (message) { - return !this.spoilered(message) || this.showContent + isShowContent () { + return !this.spoilered() || this.showContent }, - sensitive (message) { - return this.originalMessage(message).sensitive && this.mediaAttachments(message).length > 0 + sensitive () { + return this.originalMessage.sensitive && this.mediaAttachments().length > 0 }, - isShowAttachments (message) { - return !this.sensitive(message) || this.showAttachments + isShowAttachments () { + return !this.sensitive() || this.showAttachments }, - filtered (message) { - return this.filter.length > 0 && this.originalMessage(message).content.search(this.filter) >= 0 + filtered () { + return this.filter.length > 0 && this.originalMessage.content.search(this.filter) >= 0 }, locked (message) { return message.visibility === 'private' @@ -454,12 +454,12 @@ export default { directed (message) { return message.visibility === 'direct' }, - status (message) { - const original = this.originalMessage(message) + status () { + const original = this.originalMessage return emojify(original.content, original.emojis) }, - spoilerText (message) { - const original = this.originalMessage(message) + spoilerText () { + const original = this.originalMessage return emojify(original.spoiler_text, original.emojis) }, handleTootControl (event) { @@ -477,7 +477,7 @@ export default { this.$emit('focusLeft') break case 'reply': - this.openReply(this.message) + this.openReply() break case 'boost': this.changeReblog(this.message) @@ -489,10 +489,10 @@ export default { this.openDetail(this.message) break case 'profile': - this.openUser(this.originalMessage(this.message).account) + this.openUser(this.originalMessage.account) break case 'image': - const images = this.mediaAttachments(this.message) + const images = this.mediaAttachments() if (images.length === 0) { return 0 }