From 507d5bc4443ec72122a53be64527ffd681d9f77c Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 30 Aug 2018 16:27:35 +0300 Subject: [PATCH] fixup! Added logic to process reply to favorite request and update likes counter accordingly. Should fix some of cases of doubled likes and likes counter not decrementing. --- src/modules/statuses.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/statuses.js b/src/modules/statuses.js index c69c5be6..f980f53d 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -195,11 +195,11 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us const favoriteStatus = (favorite, counter) => { const status = find(allStatuses, { id: toInteger(favorite.in_reply_to_status_id) }) if (status) { - status.fave_num += 1 - // This is our favorite, so the relevant bit. if (favorite.user.id === user.id) { status.favorited = true + } else { + status.fave_num += 1 } } return status @@ -234,7 +234,7 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us 'favorite': (favorite) => { // Only update if this is a new favorite. // Ignore our own favorites because we get info about likes as response to like request - if (!state.favorites.has(favorite.id) && user.id !== favorite.user.id) { + if (!state.favorites.has(favorite.id)) { state.favorites.add(favorite.id) favoriteStatus(favorite) }