diff options
author | Jonas Sulzer <jonas@violoncello.ch> | 2019-03-12 16:38:15 +0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2019-05-03 16:30:39 -0100 |
commit | 7626c31c6f74f35d2f040ee04d048ae70c897922 (patch) | |
tree | d60270696ee694fae68974b63838801eb25d47e7 /src | |
parent | e74381fde255daa3ca6179f5c598365b12780f55 (diff) |
📦 NEW: boost frontend (button)
Signed-off-by: Jonas Sulzer <jonas@violoncello.ch>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/TimelineEntry.vue | 5 | ||||
-rw-r--r-- | src/store/timeline.js | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/components/TimelineEntry.vue b/src/components/TimelineEntry.vue index 5b17c5a3..0bd241b5 100644 --- a/src/components/TimelineEntry.vue +++ b/src/components/TimelineEntry.vue @@ -26,6 +26,7 @@ <!-- eslint-disable-next-line vue/no-v-html --> <div class="post-message" v-html="formatedMessage" /> <div v-click-outside="hidePopoverMenu" class="post-actions"> + <a v-if="this.item.actor_info.account !== this.cloudId" v-tooltip.bottom="t('social', 'Boost')" class="icon-boost" @click.prevent="boost" /> <a v-tooltip.bottom="t('social', 'Reply')" class="icon-reply" @click.prevent="reply" /> <div v-if="popoverMenu.length > 0" v-tooltip.bottom="t('social', 'More actions')" class="post-actions-more"> <a class="icon-more" @click.prevent="togglePopoverMenu" /> @@ -119,6 +120,9 @@ export default { }, reply() { this.$root.$emit('composer-reply', this.item) + }, + boost() { + this.$store.dispatch('postBoost', this.item) } } } @@ -165,6 +169,7 @@ export default { display: inline-block; } .icon-reply, + .icon-boost, .icon-more { display: inline-block; width: 44px; diff --git a/src/store/timeline.js b/src/store/timeline.js index 38f9e090..8398c0ed 100644 --- a/src/store/timeline.js +++ b/src/store/timeline.js @@ -96,6 +96,19 @@ const actions = { console.error('Failed to delete the post', error) }) }, + postBoost(context, post) { + return new Promise((resolve, reject) => { + axios.post(OC.generateUrl(`apps/social/api/v1/boost?postId=${post.id}`)).then((response) => { + // eslint-disable-next-line no-console + console.log('Post boosted with token ' + response.data.result.token) + resolve(response) + }).catch((error) => { + OC.Notification.showTemporary('Failed to create a boost post') + console.error('Failed to create a boost post', error.response) + reject(error) + }) + }) + }, refreshTimeline(context) { return this.dispatch('fetchTimeline', { sinceTimestamp: Math.floor(Date.now() / 1000) + 1 }) }, |