diff options
author | Cyrille Bollu <cyrpub@bollu.be> | 2019-10-11 14:45:11 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-10-13 23:52:59 +0200 |
commit | 8f6aa483b427cb27a27eaefd70f01f543e8978de (patch) | |
tree | e97654ebcc717ba08eeb0869a2cb67d5be3882de /src/store | |
parent | b352892a3ffa7848ee849ccb2d5a0982db52d690 (diff) |
FIX: Properly adds replies to timeline for single-post timeline
Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/timeline.js | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/src/store/timeline.js b/src/store/timeline.js index e61a1219..968e2e68 100644 --- a/src/store/timeline.js +++ b/src/store/timeline.js @@ -120,12 +120,11 @@ const actions = { post(context, post) { return new Promise((resolve, reject) => { axios.post(generateUrl('apps/social/api/v1/post'), { data: post }).then((response) => { - // eslint-disable-next-line no-console - console.log('Post created with token ' + response.data.result.token) + Logger.info('Post created with token ' + response.data.result.token) resolve(response) }).catch((error) => { OC.Notification.showTemporary('Failed to create a post') - console.error('Failed to create a post', error.response) + Logger.error('Failed to create a post', { 'error': error.response }) reject(error) }) }) @@ -133,11 +132,10 @@ const actions = { postDelete(context, post) { return axios.delete(generateUrl(`apps/social/api/v1/post?id=${post.id}`)).then((response) => { context.commit('removePost', post) - // eslint-disable-next-line no-console - console.log('Post deleted with token ' + response.data.result.token) + Logger.info('Post deleted with token ' + response.data.result.token) }).catch((error) => { OC.Notification.showTemporary('Failed to delete the post') - console.error('Failed to delete the post', error) + Logger.error('Failed to delete the post', { 'error': error }) }) }, postLike(context, { post, parentAnnounce }) { @@ -147,7 +145,7 @@ const actions = { resolve(response) }).catch((error) => { OC.Notification.showTemporary('Failed to like post') - console.error('Failed to like post', error.response) + Logger.error('Failed to like post', { 'error': error.response }) reject(error) }) }) @@ -161,19 +159,18 @@ const actions = { } }).catch((error) => { OC.Notification.showTemporary('Failed to unlike post') - console.error('Failed to unlike post', error) + Logger.error('Failed to unlike post', { 'error': error }) }) }, postBoost(context, { post, parentAnnounce }) { return new Promise((resolve, reject) => { axios.post(generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => { context.commit('boostPost', { post, parentAnnounce }) - // eslint-disable-next-line no-console - console.log('Post boosted with token ' + response.data.result.token) + Logger.info('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) + Logger.error('Failed to create a boost post', { 'error': error.response }) reject(error) }) }) @@ -181,11 +178,10 @@ const actions = { postUnBoost(context, { post, parentAnnounce }) { return axios.delete(generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => { context.commit('unboostPost', { post, parentAnnounce }) - // eslint-disable-next-line no-console - console.log('Boost deleted with token ' + response.data.result.token) + Logger.info('Boost deleted with token ' + response.data.result.token) }).catch((error) => { OC.Notification.showTemporary('Failed to delete the boost') - console.error('Failed to delete the boost', error) + Logger.error('Failed to delete the boost', { 'error': error }) }) }, refreshTimeline(context) { @@ -216,22 +212,8 @@ const actions = { throw response.message } - let result = [] - - // Also load replies when displaying a single post timeline - if (state.type === 'single-post') { - result.push(response.data) - // axios.get(generateUrl(``)).then((response) => { - // if (response.status !== -1) { - // result.concat(response.data.result) - // } - // } - } else { - result = response.data.result - } - // Add results to timeline - context.commit('addToTimeline', result) + context.commit('addToTimeline', response.data.result) return response.data }) |