summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-07-22 09:42:00 -0100
committerGitHub <noreply@github.com>2019-07-22 09:42:00 -0100
commit0d05c00349f61fb1ab209499fed2eaf8da361db2 (patch)
tree73dd701fa5d7de72b581c757f8b35fb1a78630bf
parentd3d056de964f37dd35b5cef4519df53d0b7ebf50 (diff)
parent0ae9051f2e76a15bbae8af163668c6df162438ed (diff)
Merge pull request #654 from StCyr/stCyr_fix653
refresh liked timeline when unliking a post
-rw-r--r--src/components/TimelineList.vue4
-rw-r--r--src/store/timeline.js8
2 files changed, 8 insertions, 4 deletions
diff --git a/src/components/TimelineList.vue b/src/components/TimelineList.vue
index b4c39e75..9fb2034b 100644
--- a/src/components/TimelineList.vue
+++ b/src/components/TimelineList.vue
@@ -97,6 +97,10 @@ export default {
title: t('social', 'No global posts found'),
description: t('social', 'Posts from federated instances will show up here')
},
+ liked: {
+ image: 'img/undraw/profile.svg',
+ title: t('social', 'No liked posts found')
+ }
tags: {
image: 'img/undraw/profile.svg',
title: t('social', 'No posts found for this tag')
diff --git a/src/store/timeline.js b/src/store/timeline.js
index 3146a194..978154b0 100644
--- a/src/store/timeline.js
+++ b/src/store/timeline.js
@@ -133,8 +133,6 @@ const actions = {
return new Promise((resolve, reject) => {
axios.post(OC.generateUrl(`apps/social/api/v1/post/like?postId=${post.id}`)).then((response) => {
context.commit('likePost', { post, parentAnnounce })
- // eslint-disable-next-line no-console
- console.log('Post liked with token ' + response.data.result.token)
resolve(response)
}).catch((error) => {
OC.Notification.showTemporary('Failed to like post')
@@ -146,8 +144,10 @@ const actions = {
postUnlike(context, { post, parentAnnounce }) {
return axios.delete(OC.generateUrl(`apps/social/api/v1/post/like?postId=${post.id}`)).then((response) => {
context.commit('unlikePost', { post, parentAnnounce })
- // eslint-disable-next-line no-console
- console.log('Post unliked with token ' + response.data.result.token)
+ // Remove post from list if we are in the 'liked' timeline
+ if (state.type === 'liked') {
+ context.commit('removePost', post)
+ }
}).catch((error) => {
OC.Notification.showTemporary('Failed to unlike post')
console.error('Failed to unlike post', error)