about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/reducers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-01-29 16:18:33 +0100
committerThibaut Girka <thib@sitedethib.com>2020-02-03 09:27:51 +0100
commit9dc1f7d29941865f27734d11b0f52c49c095dbcf (patch)
tree1f1e0e79227a30dd347a711626293ee6bc2563ba /app/javascript/flavours/glitch/reducers
parent369201a425f7b539290815402a4bc65923911e11 (diff)
[Glitch] Fix mascot being too large, and a code style issue
Port bba0269d9741c8c4daaa9048c265a1321d93fbba to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/reducers')
-rw-r--r--app/javascript/flavours/glitch/reducers/statuses.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/reducers/statuses.js b/app/javascript/flavours/glitch/reducers/statuses.js
index ee8ac929d..8926e49f1 100644
--- a/app/javascript/flavours/glitch/reducers/statuses.js
+++ b/app/javascript/flavours/glitch/reducers/statuses.js
@@ -41,8 +41,7 @@ export default function statuses(state = initialState, action) {
   case FAVOURITE_REQUEST:
     return state.setIn([action.status.get('id'), 'favourited'], true);
   case UNFAVOURITE_SUCCESS:
-    const favouritesCount = action.status.get('favourites_count');
-    return state.setIn([action.status.get('id'), 'favourites_count'], favouritesCount - 1);
+    return state.updateIn([action.status.get('id'), 'favourites_count'], x => Math.max(0, x - 1));
   case FAVOURITE_FAIL:
     return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'favourited'], false);
   case BOOKMARK_REQUEST: