Skip to content

Commit 51ed73c

Browse files
chrisbobbegnprice
authored andcommitted
accounts [nfc]: Inline registerComplete reducer handler-helper
It's not that big, and now there's less clicking-through required to find this code.
1 parent 5c9b17d commit 51ed73c

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/account/accountsReducer.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,6 @@ import { identityOfAccount, keyOfIdentity } from './accountMisc';
2020

2121
const initialState = NULL_ARRAY;
2222

23-
const registerComplete = (state, action) => [
24-
{
25-
...state[0],
26-
userId: action.data.user_id,
27-
zulipFeatureLevel: action.data.zulip_feature_level,
28-
zulipVersion: action.data.zulip_version,
29-
lastDismissedServerPushSetupNotice: action.data.realm_push_notifications_enabled
30-
? null
31-
: state[0].lastDismissedServerPushSetupNotice,
32-
},
33-
...state.slice(1),
34-
];
35-
3623
const findAccount = (state: AccountsState, identity: Identity): number => {
3724
const { realm, email } = identity;
3825
return state.findIndex(
@@ -95,7 +82,18 @@ const unackPushToken = (state, action) => {
9582
export default (state: AccountsState = initialState, action: Action): AccountsState => {
9683
switch (action.type) {
9784
case REGISTER_COMPLETE:
98-
return registerComplete(state, action);
85+
return [
86+
{
87+
...state[0],
88+
userId: action.data.user_id,
89+
zulipFeatureLevel: action.data.zulip_feature_level,
90+
zulipVersion: action.data.zulip_version,
91+
lastDismissedServerPushSetupNotice: action.data.realm_push_notifications_enabled
92+
? null
93+
: state[0].lastDismissedServerPushSetupNotice,
94+
},
95+
...state.slice(1),
96+
];
9997

10098
case ACCOUNT_SWITCH: {
10199
const index = state.findIndex(

0 commit comments

Comments
 (0)