summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyrille Bollu <cyrille@bollu.be>2019-07-22 11:53:09 +0200
committerCyrille Bollu <cyrille@bollu.be>2019-07-22 11:53:09 +0200
commit0ae9051f2e76a15bbae8af163668c6df162438ed (patch)
treee18b74e43109c6ff0e218b9c6ddde92681641841
parentf6a775ea53a3ff254ef8a21660d61df6123ff261 (diff)
Automaticaly removes posts from the liked timeline when they are unliked
Signed-off-by: Cyrille Bollu <cyrille@bollu.be>
-rw-r--r--src/store/timeline.js8
1 files changed, 4 insertions, 4 deletions
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)