diff --git a/web/redux/action-types.js b/web/redux/action-types.js --- a/web/redux/action-types.js +++ b/web/redux/action-types.js @@ -6,3 +6,5 @@ export const setDeviceIDActionType = 'SET_DEVICE_ID'; export const updateCalendarCommunityFilter = 'UPDATE_CALENDAR_COMMUNITY_FILTER'; export const clearCalendarCommunityFilter = 'CLEAR_CALENDAR_COMMUNITY_FILTER'; +export const updateChatCommunityFilter = 'UPDATE_CHAT_COMMUNITY_FILTER'; +export const clearChatCommunityFilter = 'CLEAR_CHAT_COMMUNITY_FILTER'; diff --git a/web/redux/community-picker-reducer.js b/web/redux/community-picker-reducer.js --- a/web/redux/community-picker-reducer.js +++ b/web/redux/community-picker-reducer.js @@ -8,6 +8,8 @@ import { updateCalendarCommunityFilter, clearCalendarCommunityFilter, + updateChatCommunityFilter, + clearChatCommunityFilter, } from './action-types.js'; import type { Action, CommunityPickerStore } from './redux-setup'; import { filterThreadIDsBelongingToCommunity } from '../selectors/calendar-selectors.js'; @@ -54,6 +56,22 @@ calendar: null, }, }; + } else if (action.type === updateChatCommunityFilter) { + return { + calendarFilters, + communityPickerStore: { + ...communityPickerStore, + chat: action.payload, + }, + }; + } else if (action.type === clearChatCommunityFilter) { + return { + calendarFilters, + communityPickerStore: { + ...communityPickerStore, + chat: null, + }, + }; } return { communityPickerStore, calendarFilters }; } diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js --- a/web/redux/redux-setup.js +++ b/web/redux/redux-setup.js @@ -40,6 +40,8 @@ updateWindowDimensionsActionType, updateCalendarCommunityFilter, clearCalendarCommunityFilter, + updateChatCommunityFilter, + clearChatCommunityFilter, } from './action-types.js'; import { reduceCommunityPickerStore } from './community-picker-reducer.js'; import { @@ -123,6 +125,14 @@ | { +type: 'CLEAR_CALENDAR_COMMUNITY_FILTER', +payload: void, + } + | { + +type: 'UPDATE_CHAT_COMMUNITY_FILTER', + +payload: string, + } + | { + +type: 'CLEAR_CHAT_COMMUNITY_FILTER', + +payload: void, }; export function reducer(oldState: AppState | void, action: Action): AppState { @@ -178,7 +188,9 @@ action.type !== setPickledPrimaryAccount && action.type !== setPickledNotificationAccount && action.type !== updateCalendarCommunityFilter && - action.type !== clearCalendarCommunityFilter + action.type !== clearCalendarCommunityFilter && + action.type !== updateChatCommunityFilter && + action.type !== clearChatCommunityFilter ) { state = baseReducer(state, action).state; }