diff --git a/lib/reducers/entry-reducer.js b/lib/reducers/entry-reducer.js --- a/lib/reducers/entry-reducer.js +++ b/lib/reducers/entry-reducer.js @@ -64,6 +64,7 @@ } from '../types/update-types.js'; import { dateString } from '../utils/date-utils.js'; import { values } from '../utils/objects.js'; +import { usingCommServicesAccessToken } from '../utils/services-utils.js'; function daysToEntriesFromEntryInfos( entryInfos: $ReadOnlyArray, @@ -218,10 +219,14 @@ daysToEntries, newEntryInfos, ); - const newLastUserInteractionCalendar = action.payload.sessionChange - .cookieInvalidated - ? 0 - : lastUserInteractionCalendar; + let newLastUserInteractionCalendar = lastUserInteractionCalendar; + if ( + action.payload.sessionChange.cookieInvalidated && + !usingCommServicesAccessToken + ) { + newLastUserInteractionCalendar = 0; + } + if (Object.keys(newEntryInfos).length === Object.keys(entryInfos).length) { return [ { diff --git a/lib/reducers/invite-links-reducer.js b/lib/reducers/invite-links-reducer.js --- a/lib/reducers/invite-links-reducer.js +++ b/lib/reducers/invite-links-reducer.js @@ -74,13 +74,26 @@ }; } else if ( action.type === logOutActionTypes.success || - action.type === deleteAccountActionTypes.success || - (action.type === setNewSessionActionType && - action.payload.sessionChange.cookieInvalidated) + action.type === deleteAccountActionTypes.success ) { return { links: {}, }; + } else if ( + action.type === setNewSessionActionType && + action.payload.sessionChange.cookieInvalidated + ) { + const { keyserverID } = action.payload; + const newLinks: { [communityID: string]: CommunityLinks } = {}; + for (const linkID in state.links) { + if (extractKeyserverIDFromID(linkID) !== keyserverID) { + newLinks[linkID] = state.links[linkID]; + } + } + return { + ...state, + links: newLinks, + }; } return state; } diff --git a/lib/reducers/thread-activity-reducer.js b/lib/reducers/thread-activity-reducer.js --- a/lib/reducers/thread-activity-reducer.js +++ b/lib/reducers/thread-activity-reducer.js @@ -106,11 +106,25 @@ return updatedState; } else if ( action.type === logOutActionTypes.success || - action.type === deleteAccountActionTypes.success || - (action.type === setNewSessionActionType && - action.payload.sessionChange.cookieInvalidated) + action.type === deleteAccountActionTypes.success ) { return {}; + } else if ( + action.type === setNewSessionActionType && + action.payload.sessionChange.cookieInvalidated + ) { + const { keyserverID } = action.payload; + let updatedState = { ...state }; + + for (const threadID in state) { + if (extractKeyserverIDFromID(threadID) !== keyserverID) { + continue; + } + const { [threadID]: _, ...stateSansRemovedThread } = updatedState; + updatedState = stateSansRemovedThread; + } + + return updatedState; } return state; }