Page MenuHomePhabricator

[web][native] Handle invalidSessionDowngrade for deleteKeyserverAccountActionTypes.success
ClosedPublic

Authored by inka on Feb 6 2024, 2:48 AM.
Tags
None
Referenced Files
F3504355: D10963.id36670.diff
Fri, Dec 20, 8:45 AM
F3500997: D10963.diff
Fri, Dec 20, 3:26 AM
Unknown Object (File)
Wed, Dec 18, 1:49 AM
Unknown Object (File)
Wed, Dec 18, 1:49 AM
Unknown Object (File)
Wed, Dec 18, 1:49 AM
Unknown Object (File)
Wed, Dec 18, 1:49 AM
Unknown Object (File)
Thu, Nov 28, 9:14 AM
Unknown Object (File)
Oct 25 2024, 6:01 PM
Subscribers

Details

Summary

Session downgrade for deleteKeyserverAccountActionTypes may be invalid for a subset of keyservers. Imagine a user disconnected from 5 keyservers, and before the success came, they reconnected to 2 of them.

In such case, we want to edit the payload and only downgrade the session for the keyservers the user has not reconnected with.

Test Plan

Dispatched an invalid session downgrade action (with a wrong cookie / sessionID)

{
	type: 'DELETE_KEYSERVER_ACCOUNT_SUCCESS',
	payload: { 
		currentUserInfo: { anonymous: true },
		preRequestUserState: {
			currentUserInfo: { id: '83810', username: 'user1'},
			cookiesAndSessions: {['256']: {cookie: 'user=123', sessionID: '0'}}
		},
		keyserverIDs: ['256'],
	},
}

Checked that the code returned.

Dispatched an action which was an invalid session downgrade for only some keyservers

{
	type: 'DELETE_KEYSERVER_ACCOUNT_SUCCESS',
	payload: { 
		currentUserInfo: { anonymous: true },
		preRequestUserState: {
			currentUserInfo: { id: '83810', username: 'user1'},
			cookiesAndSessions: {
				['256']: {cookie: <valid, current cookie>, sessionID: <valid, current sessionID>}, 
				['100']: {cookie: 'user=123', sessionID: '0'},
			}
		},
		keyserverIDs: ['256', '100'],
	},
}

And checked that the keyservers for which the downgrade was invalid were removed from the payload, and the edited action was passed to next reducers
[tested on web]

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage