🐛 FIX: correctly handle boost state

Signed-off-by: Jonas Sulzer <jonas@violoncello.ch>
pull/462/head
Jonas Sulzer 2019-04-26 13:14:01 +02:00 zatwierdzone przez Maxence Lange
rodzic 717acf0a81
commit d78758b0b6
2 zmienionych plików z 5 dodań i 12 usunięć

Wyświetl plik

@ -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)
}
}
}

Wyświetl plik

@ -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)