Skip to content

Commit

Permalink
Profile fetches shouldn't drop our own profile key
Browse files Browse the repository at this point in the history
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
  • Loading branch information
automated-signal and indutny-signal committed Mar 15, 2022
1 parent 34433f6 commit 36bb201
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ts/util/getProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ async function doGetProfile(c: ConversationModel): Promise<void> {
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.
Expand Down Expand Up @@ -306,7 +308,9 @@ async function doGetProfile(c: ConversationModel): Promise<void> {
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(
Expand Down Expand Up @@ -363,11 +367,8 @@ async function doGetProfile(c: ConversationModel): Promise<void> {
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(
Expand Down

0 comments on commit 36bb201

Please sign in to comment.