Skip to content

Commit

Permalink
wip track email from /register in Redux state
Browse files Browse the repository at this point in the history
  • Loading branch information
gnprice committed Jul 13, 2019
1 parent 446eae9 commit c4bd772
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/boot/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ const migrations: { [string]: (GlobalState) => GlobalState } = {
ackedPushToken: a.ackedPushToken !== undefined ? a.ackedPushToken : null,
})),
}),

// $FlowMigrationFudge
'7': dropCache,
};

const reduxPersistConfig: Config = {
Expand Down
4 changes: 4 additions & 0 deletions src/realm/realmReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
const initialState = {
canCreateStreams: true,
crossRealmBots: [],
email: undefined,
twentyFourHourTime: false,
emoji: {},
filters: [],
Expand All @@ -39,6 +40,7 @@ export default (state: RealmState = initialState, action: Action): RealmState =>
...state,
canCreateStreams: action.data.can_create_streams,
crossRealmBots: action.data.cross_realm_bots,
email: action.data.email,
emoji: convertRealmEmoji(action.data.realm_emoji),
filters: action.data.realm_filters,
isAdmin: action.data.is_admin,
Expand All @@ -54,6 +56,8 @@ export default (state: RealmState = initialState, action: Action): RealmState =>
emoji: {},
};

// TODO on EVENT_USER_UPDATE for self: update email, isAdmin, etc.

case EVENT_REALM_FILTERS:
return {
...state,
Expand Down
2 changes: 2 additions & 0 deletions src/reduxTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export type PresenceState = {|
* @prop emoji
*
* About the user:
* @prop email
* @prop twentyFourHourTime
* @prop canCreateStreams
* @prop isAdmin
Expand All @@ -224,6 +225,7 @@ export type RealmState = {|
filters: RealmFilter[],
emoji: RealmEmojiById,

email: string | void,
twentyFourHourTime: boolean,
canCreateStreams: boolean,
isAdmin: boolean,
Expand Down

0 comments on commit c4bd772

Please sign in to comment.