Merge pull request #654 from StCyr/stCyr_fix653

refresh liked timeline when unliking a post
pull/664/head
Maxence Lange 2019-07-22 09:42:00 -01:00 zatwierdzone przez GitHub
commit 0d05c00349
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 8 dodań i 4 usunięć

Wyświetl plik

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

Wyświetl plik

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