From c1f3b0dc75f657d046b84d358a1679a75261db63 Mon Sep 17 00:00:00 2001 From: taehoon Date: Fri, 30 Aug 2019 12:11:59 -0400 Subject: [PATCH] refactoring --- src/components/conversation/conversation.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index 2be74c1f..398b7638 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -57,7 +57,7 @@ const conversation = { if (this.status.retweeted_status) { return this.status.retweeted_status.id } else { - return this.status.id + return this.statusoid } }, conversationId () { @@ -120,23 +120,25 @@ const conversation = { methods: { fetchConversation () { if (this.status) { - this.$store.state.api.backendInteractor.fetchConversation({ id: this.status.id }) + this.$store.state.api.backendInteractor.fetchConversation({ id: this.statusoid }) .then(({ ancestors, descendants }) => { this.$store.dispatch('addNewStatuses', { statuses: ancestors }) this.$store.dispatch('addNewStatuses', { statuses: descendants }) + this.setHighlight(this.statusId) }) - .then(() => this.setHighlight(this.statusId)) } else { this.$store.state.api.backendInteractor.fetchStatus({ id: this.statusoid }) - .then((status) => this.$store.dispatch('addNewStatuses', { statuses: [status] })) - .then(() => this.fetchConversation()) + .then((status) => { + this.$store.dispatch('addNewStatuses', { statuses: [status] }) + this.fetchConversation() + }) } }, getReplies (id) { return this.replies[id] || [] }, focused (id) { - return (this.isExpanded) && id === this.status.id + return (this.isExpanded) && id === this.statusoid }, setHighlight (id) { if (!id) return