diff --git a/lib/reducers/calendar-filters-reducer.js b/lib/reducers/calendar-filters-reducer.js --- a/lib/reducers/calendar-filters-reducer.js +++ b/lib/reducers/calendar-filters-reducer.js @@ -47,6 +47,7 @@ processUpdatesActionType, } from '../types/update-types.js'; import { filterThreadIDsBelongingToCommunity } from '../utils/drawer-utils.react.js'; +import { usingCommServicesAccessToken } from '../utils/services-utils.js'; export default function reduceCalendarFilters( state: $ReadOnlyArray, @@ -56,7 +57,6 @@ if ( action.type === tempIdentityLoginActionTypes.success || action.type === logOutActionTypes.success || - action.type === deleteKeyserverAccountActionTypes.success || action.type === logInActionTypes.success || action.type === siweAuthActionTypes.success || action.type === keyserverRegisterActionTypes.success || @@ -64,6 +64,14 @@ action.payload.sessionChange.cookieInvalidated) ) { return defaultCalendarFilters; + } else if (action.type === deleteKeyserverAccountActionTypes.success) { + if (!usingCommServicesAccessToken) { + return defaultCalendarFilters; + } + return removeKeyserverThreadIDsFromFilterList( + state, + action.payload.keyserverIDs, + ); } else if (action.type === keyserverAuthActionTypes.success) { const keyserverIDs = Object.keys(action.payload.updatesCurrentAsOf); return removeKeyserverThreadIDsFromFilterList(state, keyserverIDs); diff --git a/lib/reducers/calendar-query-reducer.js b/lib/reducers/calendar-query-reducer.js --- a/lib/reducers/calendar-query-reducer.js +++ b/lib/reducers/calendar-query-reducer.js @@ -1,5 +1,6 @@ // @flow +import { removeKeyserverThreadIDsFromFilterList } from './calendar-filters-reducer.js'; import { updateCalendarQueryActionTypes } from '../actions/entry-actions.js'; import { siweAuthActionTypes } from '../actions/siwe-actions.js'; import { @@ -17,6 +18,7 @@ incrementalStateSyncActionType, } from '../types/socket-types.js'; import { getConfig } from '../utils/config.js'; +import { usingCommServicesAccessToken } from '../utils/services-utils.js'; function reduceCalendarQuery( state: CalendarQuery, @@ -24,11 +26,21 @@ ): CalendarQuery { if ( action.type === logOutActionTypes.success || - action.type === deleteKeyserverAccountActionTypes.success || (action.type === setNewSessionActionType && action.payload.sessionChange.cookieInvalidated) ) { return defaultCalendarQuery(getConfig().platformDetails.platform); + } else if (action.type === deleteKeyserverAccountActionTypes.success) { + if (!usingCommServicesAccessToken) { + return defaultCalendarQuery(getConfig().platformDetails.platform); + } + return { + ...state, + filters: removeKeyserverThreadIDsFromFilterList( + state.filters, + action.payload.keyserverIDs, + ), + }; } else if ( action.type === logInActionTypes.success || action.type === siweAuthActionTypes.success