From 36bb20153793e0ffca84b5272c09443c9d893f69 Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Tue, 15 Mar 2022 13:24:23 -0700 Subject: [PATCH] Profile fetches shouldn't drop our own profile key Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> --- ts/util/getProfile.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ts/util/getProfile.ts b/ts/util/getProfile.ts index 8c4ca6a949..c31ff62af0 100644 --- a/ts/util/getProfile.ts +++ b/ts/util/getProfile.ts @@ -131,7 +131,9 @@ async function doGetProfile(c: ConversationModel): Promise { throw error; } if (error.code === 401 || error.code === 403) { - await c.setProfileKey(undefined); + if (!isMe(c.attributes)) { + await c.setProfileKey(undefined); + } // Retry fetch using last known profileKeyVersion or fetch // unversioned profile. @@ -306,7 +308,9 @@ async function doGetProfile(c: ConversationModel): Promise { log.warn( `getProfile: Got 401/403 when using accessKey for ${idForLogging}, removing profileKey` ); - c.setProfileKey(undefined); + if (!isMe(c.attributes)) { + await c.setProfileKey(undefined); + } } if (c.get('sealedSender') === SEALED_SENDER.UNKNOWN) { log.warn( @@ -363,11 +367,8 @@ async function doGetProfile(c: ConversationModel): Promise { if (error instanceof HTTPError) { if (error.code === 403 || error.code === 404) { log.warn( - `getProfile: clearing profile avatar for conversation ${idForLogging}` + `getProfile: profile avatar is missing for conversation ${idForLogging}` ); - c.set({ - profileAvatar: null, - }); } } else { log.warn(