Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32523158
D10426.1767134096.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D10426.1767134096.diff
View Options
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
@@ -12,10 +12,12 @@
deleteThreadActionTypes,
} from '../actions/thread-actions.js';
import {
+ keyserverAuthActionTypes,
logOutActionTypes,
deleteKeyserverAccountActionTypes,
logInActionTypes,
registerActionTypes,
+ tempIdentityLoginActionTypes,
} from '../actions/user-actions.js';
import {
filteredThreadIDs,
@@ -54,6 +56,7 @@
threadStore: ThreadStore,
): $ReadOnlyArray<CalendarFilter> {
if (
+ action.type === tempIdentityLoginActionTypes.success ||
action.type === logOutActionTypes.success ||
action.type === deleteKeyserverAccountActionTypes.success ||
action.type === logInActionTypes.success ||
@@ -63,6 +66,9 @@
action.payload.sessionChange.cookieInvalidated)
) {
return defaultCalendarFilters;
+ } else if (action.type === keyserverAuthActionTypes.success) {
+ const keyserverIDs = Object.keys(action.payload.updatesCurrentAsOf);
+ return removeKeyserverThreadIDsFromFilterList(state, keyserverIDs);
} else if (action.type === updateCalendarThreadFilter) {
const nonThreadFilters = nonThreadCalendarFilters(state);
return [
diff --git a/lib/reducers/calendar-filters-reducer.test.js b/lib/reducers/calendar-filters-reducer.test.js
--- a/lib/reducers/calendar-filters-reducer.test.js
+++ b/lib/reducers/calendar-filters-reducer.test.js
@@ -1,9 +1,11 @@
// @flow
-import {
+import reduceCalendarFilters, {
removeDeletedThreadIDsFromFilterList,
removeKeyserverThreadIDsFromFilterList,
} from './calendar-filters-reducer.js';
+import { keyserverAuthActionTypes } from '../actions/user-actions.js';
+import type { RawMessageInfo } from '../types/message-types.js';
import type { ThreadStore } from '../types/thread-types';
const calendarFilters = [
@@ -171,3 +173,49 @@
]);
});
});
+
+describe('reduceCalendarFilters', () => {
+ it('Removes from filters thread ids of the keyservers that were logged into', () => {
+ const messageInfos: RawMessageInfo[] = [];
+ const payload = {
+ currentUserInfo: { id: '5', username: 'me' },
+ threadInfos: {},
+ messagesResult: {
+ currentAsOf: {},
+ messageInfos,
+ truncationStatus: {},
+ watchedIDsAtRequestTime: [],
+ },
+ userInfos: [],
+ calendarResult: {
+ rawEntryInfos: [],
+ calendarQuery: { startDate: '0', endDate: '0', filters: [] },
+ },
+ // only updatesCurrentAsOf is relevant to this test
+ updatesCurrentAsOf: { [keyserverToRemove1]: 5, [keyserverToRemove2]: 5 },
+ logInActionSource: 'SOCKET_AUTH_ERROR_RESOLUTION_ATTEMPT',
+ };
+
+ expect(
+ reduceCalendarFilters(
+ calendarFiltersState,
+ {
+ type: keyserverAuthActionTypes.success,
+ payload,
+ loadingInfo: {
+ customKeyName: null,
+ trackMultipleRequests: false,
+ fetchIndex: 1,
+ },
+ },
+ { threadInfos: {} },
+ ),
+ ).toEqual([
+ { type: 'not_deleted' },
+ {
+ type: 'threads',
+ threadIDs: threadIDsToStay,
+ },
+ ]);
+ });
+});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 30, 10:34 PM (11 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5870551
Default Alt Text
D10426.1767134096.diff (3 KB)
Attached To
Mode
D10426: [lib] Reduce new login actions in reduceCalendarFilters
Attached
Detach File
Event Timeline
Log In to Comment