kopia lustrzana https://github.com/nextcloud/social
🐛 FIX: correctly handle boost state
Signed-off-by: Jonas Sulzer <jonas@violoncello.ch>pull/462/head
rodzic
717acf0a81
commit
d78758b0b6
|
@ -118,13 +118,9 @@ export default {
|
|||
isBoosted() {
|
||||
if (typeof this.item.action === 'undefined') {
|
||||
return false;
|
||||
} else {
|
||||
if (this.item.action.values.boosted === false) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return !!this.item.action.values.boosted;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -135,12 +131,10 @@ export default {
|
|||
this.$root.$emit('composer-reply', this.item)
|
||||
},
|
||||
boost() {
|
||||
if (typeof this.item.action === 'undefined') {
|
||||
this.$store.dispatch('postBoost', this.item)
|
||||
} else if (!this.item.action.values.boosted) {
|
||||
this.$store.dispatch('postBoost', this.item)
|
||||
} else {
|
||||
if (this.isBoosted) {
|
||||
this.$store.dispatch('postUnBoost', this.item)
|
||||
} else {
|
||||
this.$store.dispatch('postBoost', this.item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,6 @@ const actions = {
|
|||
},
|
||||
postUnBoost(context, post) {
|
||||
return axios.delete(OC.generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
|
||||
context.commit('removeBoost', post)
|
||||
post.action.values.boosted = false
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Boost deleted with token ' + response.data.result.token)
|
||||
|
|
Ładowanie…
Reference in New Issue