Skip to content

Commit

Permalink
Clear profile avatar when we discover that it has been removed
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Jul 3, 2021
1 parent 5f28249 commit ebd69d1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions ts/models/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4601,13 +4601,18 @@ export class ConversationModel extends window.Backbone
}
}

async setProfileAvatar(avatarPath: string): Promise<void> {
if (!avatarPath) {
return;
async setProfileAvatar(avatarPath: undefined | null | string): Promise<void> {
if (isMe(this.attributes)) {
if (avatarPath) {
window.storage.put('avatarUrl', avatarPath);
} else {
window.storage.remove('avatarUrl');
}
}

if (isMe(this.attributes)) {
window.storage.put('avatarUrl', avatarPath);
if (!avatarPath) {
this.set({ profileAvatar: undefined });
return;
}

const avatar = await window.textsecure.messaging.getAvatar(avatarPath);
Expand Down

0 comments on commit ebd69d1

Please sign in to comment.