Settings: Fix selecting main profile photo (#2887)
This commit is contained in:
parent
fbdeb9fd40
commit
2e9dcb8060
@ -106,7 +106,7 @@ addActionHandler('updateProfilePhoto', async (global, actions, payload): Promise
|
||||
const { photo, isFallback } = payload;
|
||||
const { currentUserId } = global;
|
||||
if (!currentUserId) return;
|
||||
const currentUser = selectChat(global, currentUserId);
|
||||
const currentUser = selectUser(global, currentUserId);
|
||||
if (!currentUser) return;
|
||||
|
||||
global = updateUser(global, currentUserId, {
|
||||
@ -121,17 +121,9 @@ addActionHandler('updateProfilePhoto', async (global, actions, payload): Promise
|
||||
const result = await callApi('updateProfilePhoto', photo, isFallback);
|
||||
if (!result) return;
|
||||
|
||||
const { photo: newPhoto, users } = result;
|
||||
const { users } = result;
|
||||
global = getGlobal();
|
||||
global = addUsers(global, buildCollectionByKey(users, 'id'));
|
||||
|
||||
global = updateUser(global, currentUserId, {
|
||||
avatarHash: newPhoto.id,
|
||||
fullInfo: {
|
||||
...currentUser.fullInfo,
|
||||
profilePhoto: newPhoto,
|
||||
},
|
||||
});
|
||||
setGlobal(global);
|
||||
|
||||
actions.loadFullUser({ userId: currentUserId });
|
||||
|
||||
@ -246,7 +246,7 @@ addActionHandler('loadProfilePhotos', async (global, actions, payload): Promise<
|
||||
return;
|
||||
}
|
||||
|
||||
if (user && !user?.fullInfo) {
|
||||
if (user && !user.fullInfo?.profilePhoto) {
|
||||
const { id, accessHash } = user;
|
||||
user = await callApi('fetchFullUser', { id, accessHash });
|
||||
if (!user) return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user