refetch favs and repeats when stats are changed

This commit is contained in:
taehoon 2019-06-24 05:19:43 -04:00
parent 17498ef906
commit e9b6e0e2b7

View file

@ -402,6 +402,9 @@ const Status = {
setMedia () {
const attachments = this.attachmentSize === 'hide' ? this.status.attachments : this.galleryAttachments
return () => this.$store.dispatch('setMedia', attachments)
},
refetchFavsAndRepeats () {
this.$store.dispatch('fetchFavsAndRepeats', this.status.id)
}
},
watch: {
@ -419,6 +422,16 @@ const Status = {
window.scrollBy(0, rect.bottom - window.innerHeight + 50)
}
}
},
'status.repeat_num': function (num) {
if (this.isFocused && this.statusFromGlobalRepository.rebloggedBy && this.statusFromGlobalRepository.rebloggedBy.length !== num) {
this.refetchFavsAndRepeats()
}
},
'status.fave_num': function (num) {
if (this.isFocused && this.statusFromGlobalRepository.favoritedBy && this.statusFromGlobalRepository.favoritedBy.length !== num) {
this.refetchFavsAndRepeats()
}
}
},
filters: {