Update replies/reblogs/favourites count in statuses
This commit is contained in:
parent
bc22b54e4c
commit
85b5bc2098
|
@ -122,22 +122,28 @@
|
|||
store: () => store,
|
||||
methods: {
|
||||
toggleFavorite (announce) {
|
||||
const { originalStatusId, favorited } = this.get()
|
||||
const { originalStatusId, favorited, originalStatus } = this.get()
|
||||
const newFavoritedValue = !favorited
|
||||
/* no await */ setFavorited(originalStatusId, newFavoritedValue)
|
||||
if (newFavoritedValue) {
|
||||
this.refs.favoriteIcon.animate(FAVORITE_ANIMATION, CHECKMARK_ANIMATION)
|
||||
originalStatus.favourites_count++
|
||||
} else {
|
||||
originalStatus.favourites_count--
|
||||
}
|
||||
if (announce) {
|
||||
announceAriaLivePolite(newFavoritedValue ? 'intl.favorited' : 'intl.unfavorited')
|
||||
}
|
||||
},
|
||||
reblog (announce) {
|
||||
const { originalStatusId, reblogged } = this.get()
|
||||
const { originalStatusId, reblogged, originalStatus } = this.get()
|
||||
const newRebloggedValue = !reblogged
|
||||
/* no await */ setReblogged(originalStatusId, newRebloggedValue)
|
||||
if (newRebloggedValue) {
|
||||
this.refs.reblogIcon.animate(REBLOG_ANIMATION, CHECKMARK_ANIMATION)
|
||||
originalStatus.reblogs_count++
|
||||
} else {
|
||||
originalStatus.reblogs_count--
|
||||
}
|
||||
if (announce) {
|
||||
announceAriaLivePolite(newRebloggedValue ? 'intl.reblogged' : 'intl.unreblogged')
|
||||
|
@ -169,12 +175,14 @@
|
|||
onPostedStatus (realm, inReplyToUuid) {
|
||||
const {
|
||||
originalStatusId,
|
||||
uuid
|
||||
uuid,
|
||||
originalStatus
|
||||
} = this.get()
|
||||
if (realm !== originalStatusId ||
|
||||
inReplyToUuid !== uuid) {
|
||||
return
|
||||
}
|
||||
originalStatus.replies_count++
|
||||
try {
|
||||
// return status to the reply button after posting a reply
|
||||
this.refs.node.querySelector('.status-toolbar-reply-button').focus({ preventScroll: true })
|
||||
|
|
Loading…
Reference in New Issue