From d78758b0b6090f8687f2ebc5f8810273d0713264 Mon Sep 17 00:00:00 2001 From: Jonas Sulzer Date: Fri, 26 Apr 2019 13:14:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20correctly=20handle=20boos?= =?UTF-8?q?t=20state?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jonas Sulzer --- src/components/TimelineEntry.vue | 16 +++++----------- src/store/timeline.js | 1 - 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/components/TimelineEntry.vue b/src/components/TimelineEntry.vue index 4e0222a5..d3b8b2dd 100644 --- a/src/components/TimelineEntry.vue +++ b/src/components/TimelineEntry.vue @@ -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) } } } diff --git a/src/store/timeline.js b/src/store/timeline.js index 254c4ad7..f892a411 100644 --- a/src/store/timeline.js +++ b/src/store/timeline.js @@ -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)