diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index 262e6b890b..b4be7296f3 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -4601,13 +4601,18 @@ export class ConversationModel extends window.Backbone } } - async setProfileAvatar(avatarPath: string): Promise { - if (!avatarPath) { - return; + async setProfileAvatar(avatarPath: undefined | null | string): Promise { + 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);