Re-use conversation property.

This commit is contained in:
Roger Braun 2017-06-05 12:15:30 +02:00
parent 64a7db1d8b
commit 9af18e014d
1 changed files with 5 additions and 7 deletions

View File

@ -10,8 +10,7 @@ const sortAndFilterConversation = (conversation) => {
const conversation = { const conversation = {
data () { data () {
return { return {
highlight: null, highlight: null
statuses: []
} }
}, },
props: [ props: [
@ -28,8 +27,7 @@ const conversation = {
const conversationId = this.status.statusnet_conversation_id const conversationId = this.status.statusnet_conversation_id
const statuses = this.$store.state.statuses.allStatuses const statuses = this.$store.state.statuses.allStatuses
const conversation = filter(statuses, { statusnet_conversation_id: conversationId }) const conversation = filter(statuses, { statusnet_conversation_id: conversationId })
this.statuses = sortAndFilterConversation(conversation) return sortAndFilterConversation(conversation)
return this.statuses
} }
}, },
components: { components: {
@ -59,11 +57,11 @@ const conversation = {
let res = [] let res = []
id = Number(id) id = Number(id)
let i let i
for (i = 0; i < this.statuses.length; i++) { for (i = 0; i < this.conversation.length; i++) {
if (Number(this.statuses[i].in_reply_to_status_id) === id) { if (Number(this.conversation[i].in_reply_to_status_id) === id) {
res.push({ res.push({
name: `#${i}`, name: `#${i}`,
id: this.statuses[i].id id: this.conversation[i].id
}) })
} }
} }