From 483f7187fce6ececcba09e60ea124939455450bf Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Fri, 30 Apr 2021 15:04:52 +0200 Subject: [PATCH] MM-34069 include current user in return values from getProfile* actions (#5308) (#5363) (cherry picked from commit f14d4ee70ffb4d7107fcfbd968aecf8e7496189f) Co-authored-by: Elias Nahum --- app/mm-redux/actions/users.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/mm-redux/actions/users.ts b/app/mm-redux/actions/users.ts index ae89ba907..a795208ad 100644 --- a/app/mm-redux/actions/users.ts +++ b/app/mm-redux/actions/users.ts @@ -242,7 +242,6 @@ export function getProfiles(page = 0, perPage: number = General.PROFILE_CHUNK_SI try { profiles = await Client4.getProfiles(page, perPage, options); - removeUserFromList(currentUserId, profiles); } catch (error) { forceLogoutIfNecessary(error, dispatch, getState); dispatch(logError(error)); @@ -251,7 +250,7 @@ export function getProfiles(page = 0, perPage: number = General.PROFILE_CHUNK_SI dispatch({ type: UserTypes.RECEIVED_PROFILES_LIST, - data: profiles, + data: removeUserFromList(currentUserId, [...profiles]), }); return {data: profiles}; @@ -307,7 +306,6 @@ export function getProfilesByIds(userIds: Array, options?: any): ActionF try { profiles = await Client4.getProfilesByIds(userIds, options); - removeUserFromList(currentUserId, profiles); } catch (error) { forceLogoutIfNecessary(error, dispatch, getState); dispatch(logError(error)); @@ -316,7 +314,7 @@ export function getProfilesByIds(userIds: Array, options?: any): ActionF dispatch({ type: UserTypes.RECEIVED_PROFILES_LIST, - data: profiles, + data: removeUserFromList(currentUserId, [...profiles]), }); return {data: profiles}; @@ -330,7 +328,6 @@ export function getProfilesByUsernames(usernames: Array): ActionFunc { try { profiles = await Client4.getProfilesByUsernames(usernames); - removeUserFromList(currentUserId, profiles); } catch (error) { forceLogoutIfNecessary(error, dispatch, getState); dispatch(logError(error)); @@ -339,7 +336,7 @@ export function getProfilesByUsernames(usernames: Array): ActionFunc { dispatch({ type: UserTypes.RECEIVED_PROFILES_LIST, - data: profiles, + data: removeUserFromList(currentUserId, [...profiles]), }); return {data: profiles};