]> cat aescling's git repositories - mastodon.git/commitdiff
Fix bell button causing a brief “Cancel follow request” on locked accounts (#14896)
authorThibG <thib@sitedethib.com>
Mon, 28 Sep 2020 19:44:29 +0000 (21:44 +0200)
committerGitHub <noreply@github.com>
Mon, 28 Sep 2020 19:44:29 +0000 (21:44 +0200)
app/javascript/mastodon/reducers/relationships.js

index 1d050cc6349915a25036380113c1a7cf0dcd52c6..53949258a3206b1da3127442d79127406a0cb6d9 100644 (file)
@@ -45,7 +45,7 @@ const initialState = ImmutableMap();
 export default function relationships(state = initialState, action) {
   switch(action.type) {
   case ACCOUNT_FOLLOW_REQUEST:
-    return state.setIn([action.id, action.locked ? 'requested' : 'following'], true);
+    return state.getIn([action.id, 'following']) ? state : state.setIn([action.id, action.locked ? 'requested' : 'following'], true);
   case ACCOUNT_FOLLOW_FAIL:
     return state.setIn([action.id, action.locked ? 'requested' : 'following'], false);
   case ACCOUNT_UNFOLLOW_REQUEST: