stop fetching whole conversation when change highlighted status
This commit is contained in:
parent
c1f3b0dc75
commit
482cd52f77
1 changed files with 15 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { reduce, filter, findIndex, clone } from 'lodash'
|
import { reduce, filter, findIndex, clone, get } from 'lodash'
|
||||||
import Status from '../status/status.vue'
|
import Status from '../status/status.vue'
|
||||||
|
|
||||||
const sortById = (a, b) => {
|
const sortById = (a, b) => {
|
||||||
|
@ -61,11 +61,7 @@ const conversation = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
conversationId () {
|
conversationId () {
|
||||||
if (this.status.retweeted_status) {
|
return this.getConversationId(this.statusoid)
|
||||||
return this.status.retweeted_status.statusnet_conversation_id
|
|
||||||
} else {
|
|
||||||
return this.status.statusnet_conversation_id
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
conversation () {
|
conversation () {
|
||||||
if (!this.status) {
|
if (!this.status) {
|
||||||
|
@ -110,7 +106,15 @@ const conversation = {
|
||||||
Status
|
Status
|
||||||
},
|
},
|
||||||
watch: {
|
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) {
|
expanded (value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
this.fetchConversation()
|
this.fetchConversation()
|
||||||
|
@ -150,6 +154,10 @@ const conversation = {
|
||||||
},
|
},
|
||||||
toggleExpanded () {
|
toggleExpanded () {
|
||||||
this.expanded = !this.expanded
|
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'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue