about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/reducers/accounts_counters.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-12-17 21:23:44 +0100
committerThibG <thib@sitedethib.com>2018-12-20 14:51:12 +0100
commit1b18eb49e378e31e805e84563eb5d3c88ad3cf7e (patch)
treec3e052f5bdbbb33ee4da261ff056b62bc441363c /app/javascript/flavours/glitch/reducers/accounts_counters.js
parenta1c56fcef124b08fc2676d38fd79ed72d660d865 (diff)
Hide negative follower counts from glitch flavour
Diffstat (limited to 'app/javascript/flavours/glitch/reducers/accounts_counters.js')
-rw-r--r--app/javascript/flavours/glitch/reducers/accounts_counters.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/reducers/accounts_counters.js b/app/javascript/flavours/glitch/reducers/accounts_counters.js
index 64dff9b55..acf363ca5 100644
--- a/app/javascript/flavours/glitch/reducers/accounts_counters.js
+++ b/app/javascript/flavours/glitch/reducers/accounts_counters.js
@@ -141,9 +141,9 @@ export default function accountsCounters(state = initialState, action) {
     if (action.alreadyFollowing) {
       return state;
     }
-    return state.updateIn([action.relationship.id, 'followers_count'], num => num + 1);
+    return state.updateIn([action.relationship.id, 'followers_count'], num => num < 0 ? num : num + 1);
   case ACCOUNT_UNFOLLOW_SUCCESS:
-    return state.updateIn([action.relationship.id, 'followers_count'], num => Math.max(0, num - 1));
+    return state.updateIn([action.relationship.id, 'followers_count'], num => num < 0 ? num : Math.max(0, num - 1));
   default:
     return state;
   }