Skip to content
Snippets Groups Projects
Commit 482cd52f authored by Tae Hoon's avatar Tae Hoon
Browse files

stop fetching whole conversation when change highlighted status

parent c1f3b0dc
Branches
No related tags found
No related merge requests found
import { reduce, filter, findIndex, clone } from 'lodash'
import { reduce, filter, findIndex, clone, get } from 'lodash'
import Status from '../status/status.vue'
const sortById = (a, b) => {
......@@ -61,11 +61,7 @@ const conversation = {
}
},
conversationId () {
if (this.status.retweeted_status) {
return this.status.retweeted_status.statusnet_conversation_id
} else {
return this.status.statusnet_conversation_id
}
return this.getConversationId(this.statusoid)
},
conversation () {
if (!this.status) {
......@@ -110,7 +106,15 @@ const conversation = {
Status
},
watch: {
status: 'fetchConversation',
statusoid (newVal, oldVal) {
const newConversationId = this.getConversationId(newVal)
const oldConversationId = this.getConversationId(oldVal)
if (newConversationId && oldConversationId && newConversationId === oldConversationId) {
this.setHighlight(this.statusId)
} else {
this.fetchConversation()
}
},
expanded (value) {
if (value) {
this.fetchConversation()
......@@ -150,6 +154,10 @@ const conversation = {
},
toggleExpanded () {
this.expanded = !this.expanded
},
getConversationId (statusId) {
const status = this.$store.state.statuses.allStatusesObject[statusId]
return get(status, 'retweeted_status.statusnet_conversation_id', get(status, 'statusnet_conversation_id'))
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment