mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-57121] Remove remote_id if necessary when merging user profile (#26826)
This commit is contained in:
parent
0948ce1776
commit
173ff52e18
@ -746,6 +746,26 @@ describe('Reducers.users', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test(`should remove remote_id when not set anymore (${actionType})`, () => {
|
||||||
|
const user1 = TestHelper.getUserMock({id: 'user_id1', remote_id: 'abcdef'});
|
||||||
|
const user1WithoutRemoteId = TestHelper.getUserMock({id: 'user_id1'});
|
||||||
|
|
||||||
|
const state = deepFreezeAndThrowOnMutation({
|
||||||
|
profiles: {
|
||||||
|
[user1.id]: user1,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const nextState = reducer(state, {
|
||||||
|
type: actionType,
|
||||||
|
data: user1WithoutRemoteId,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(nextState.profiles).toEqual({
|
||||||
|
[user1.id]: user1WithoutRemoteId,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test(`should not overwrite unsanitized data with sanitized data (${actionType})`, () => {
|
test(`should not overwrite unsanitized data with sanitized data (${actionType})`, () => {
|
||||||
const user1 = TestHelper.getUserMock({
|
const user1 = TestHelper.getUserMock({
|
||||||
id: 'user_id1',
|
id: 'user_id1',
|
||||||
|
@ -169,6 +169,11 @@ function receiveUserProfile(state: IDMappedObjects<UserProfile>, received: UserP
|
|||||||
...received,
|
...received,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// If there was a remote_id but not anymore, remove it
|
||||||
|
if (existing.remote_id && !received.remote_id) {
|
||||||
|
delete merged.remote_id;
|
||||||
|
}
|
||||||
|
|
||||||
// MM-53377:
|
// MM-53377:
|
||||||
// For non-admin users, certain API responses don't return details for the current user that would be sanitized
|
// For non-admin users, certain API responses don't return details for the current user that would be sanitized
|
||||||
// out for others. This currently includes:
|
// out for others. This currently includes:
|
||||||
|
Loading…
Reference in New Issue
Block a user