diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-11-08 21:05:42 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-09-28 17:49:55 +0200 |
commit | 0a069bffd9d1318f5a1b28f03afe92e96a61fdf3 (patch) | |
tree | 39e9274fca07954ae961fd4677cc4205368d33f5 /app/javascript/flavours/glitch/reducers | |
parent | 6775de3fc98c46e26a07ed69f6f2459e6b1fce70 (diff) |
[Glitch] Optimize the process of following someone
Port front-end changes from 6d59dfa15d873da75c731b79367ab6b3d1b2f5a5 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/relationships.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/reducers/relationships.js b/app/javascript/flavours/glitch/reducers/relationships.js index dcaeefcae..33eb5b425 100644 --- a/app/javascript/flavours/glitch/reducers/relationships.js +++ b/app/javascript/flavours/glitch/reducers/relationships.js @@ -1,6 +1,10 @@ import { ACCOUNT_FOLLOW_SUCCESS, + ACCOUNT_FOLLOW_REQUEST, + ACCOUNT_FOLLOW_FAIL, ACCOUNT_UNFOLLOW_SUCCESS, + ACCOUNT_UNFOLLOW_REQUEST, + ACCOUNT_UNFOLLOW_FAIL, ACCOUNT_BLOCK_SUCCESS, ACCOUNT_UNBLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS, @@ -40,6 +44,14 @@ 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); + case ACCOUNT_FOLLOW_FAIL: + return state.setIn([action.id, action.locked ? 'requested' : 'following'], false); + case ACCOUNT_UNFOLLOW_REQUEST: + return state.setIn([action.id, 'following'], false); + case ACCOUNT_UNFOLLOW_FAIL: + return state.setIn([action.id, 'following'], true); case ACCOUNT_FOLLOW_SUCCESS: case ACCOUNT_UNFOLLOW_SUCCESS: case ACCOUNT_BLOCK_SUCCESS: |