From d6c62fa50f1992c109c60d03aa44f5ed3ee94284 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 21 Mar 2019 23:27:14 +0200 Subject: [PATCH] minor UI improvements - keep current behavior of showing originating post initially --- src/components/conversation-page/conversation-page.js | 5 ++--- src/components/conversation/conversation.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/conversation-page/conversation-page.js b/src/components/conversation-page/conversation-page.js index 8f1ac3d9..1da70ce9 100644 --- a/src/components/conversation-page/conversation-page.js +++ b/src/components/conversation-page/conversation-page.js @@ -1,5 +1,4 @@ import Conversation from '../conversation/conversation.vue' -import { find } from 'lodash' const conversationPage = { components: { @@ -8,8 +7,8 @@ const conversationPage = { computed: { statusoid () { const id = this.$route.params.id - const statuses = this.$store.state.statuses.allStatuses - const status = find(statuses, {id}) + const statuses = this.$store.state.statuses.allStatusesObject + const status = statuses[id] return status } diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 32bab144..e543102a 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -37,6 +37,15 @@ const conversation = { status () { return this.statusoid }, + idsToShow () { + if (this.relevantIds.length > 0) { + return this.relevantIds + } else if (this.statusId) { + return [this.statusId] + } else { + return [] + } + }, statusId () { if (this.statusoid.retweeted_status) { return this.statusoid.retweeted_status.id @@ -50,7 +59,7 @@ const conversation = { } const statusesObject = this.$store.state.statuses.allStatusesObject - const conversation = this.relevantIds.reduce((acc, id) => { + const conversation = this.idsToShow.reduce((acc, id) => { acc.push(statusesObject[id]) return acc }, [])