Clear profile avatar when we discover that it has been removed

This commit is contained in:
Scott Nonnenberg 2021-07-02 13:16:23 -07:00 committed by GitHub
parent 299fe2af36
commit b50bf58418
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4589,12 +4589,17 @@ export class ConversationModel extends window.Backbone
} }
async setProfileAvatar(avatarPath: undefined | null | string): Promise<void> { async setProfileAvatar(avatarPath: undefined | null | string): Promise<void> {
if (!avatarPath) { if (isMe(this.attributes)) {
return; if (avatarPath) {
window.storage.put('avatarUrl', avatarPath);
} else {
window.storage.remove('avatarUrl');
}
} }
if (isMe(this.attributes)) { if (!avatarPath) {
window.storage.put('avatarUrl', avatarPath); this.set({ profileAvatar: undefined });
return;
} }
const avatar = await window.textsecure.messaging.getAvatar(avatarPath); const avatar = await window.textsecure.messaging.getAvatar(avatarPath);