minor UI improvements - keep current behavior of showing originating post initially

This commit is contained in:
Henry Jameson 2019-03-21 23:27:14 +02:00
parent ee94a6732a
commit d6c62fa50f
2 changed files with 12 additions and 4 deletions

View file

@ -1,5 +1,4 @@
import Conversation from '../conversation/conversation.vue' import Conversation from '../conversation/conversation.vue'
import { find } from 'lodash'
const conversationPage = { const conversationPage = {
components: { components: {
@ -8,8 +7,8 @@ const conversationPage = {
computed: { computed: {
statusoid () { statusoid () {
const id = this.$route.params.id const id = this.$route.params.id
const statuses = this.$store.state.statuses.allStatuses const statuses = this.$store.state.statuses.allStatusesObject
const status = find(statuses, {id}) const status = statuses[id]
return status return status
} }

View file

@ -37,6 +37,15 @@ const conversation = {
status () { status () {
return this.statusoid return this.statusoid
}, },
idsToShow () {
if (this.relevantIds.length > 0) {
return this.relevantIds
} else if (this.statusId) {
return [this.statusId]
} else {
return []
}
},
statusId () { statusId () {
if (this.statusoid.retweeted_status) { if (this.statusoid.retweeted_status) {
return this.statusoid.retweeted_status.id return this.statusoid.retweeted_status.id
@ -50,7 +59,7 @@ const conversation = {
} }
const statusesObject = this.$store.state.statuses.allStatusesObject 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]) acc.push(statusesObject[id])
return acc return acc
}, []) }, [])