[web][native] Handle invalidSessionDowngrade for deleteKeyserverAccountActionTypes.success
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]
Reviewers: michal, kamil, ginsu
Reviewed By: michal
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D10963