Page MenuHomePhabricator

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

Authored by inka on Feb 6 2024, 2:48 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 4, 12:34 AM
Unknown Object (File)
Fri, Oct 4, 12:34 AM
Unknown Object (File)
Fri, Oct 4, 12:34 AM
Unknown Object (File)
Fri, Oct 4, 12:34 AM
Unknown Object (File)
Aug 29 2024, 10:21 AM
Unknown Object (File)
Aug 15 2024, 5:31 PM
Unknown Object (File)
Jul 31 2024, 9:44 PM
Unknown Object (File)
Jul 31 2024, 9:44 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
Lint Not Applicable
Unit
Tests Not Applicable