Properly download new group avatars
This commit is contained in:
parent
d97dae6a87
commit
ab2cc6ee53
2 changed files with 7 additions and 4 deletions
|
@ -1480,7 +1480,7 @@
|
|||
};
|
||||
}
|
||||
|
||||
let group = this.get('group');
|
||||
let group = this.get('group_update');
|
||||
if (group && group.avatar) {
|
||||
group = {
|
||||
...group,
|
||||
|
|
|
@ -364,10 +364,11 @@ async function _addAttachmentToMessage(message, attachment, { type, index }) {
|
|||
}
|
||||
|
||||
if (type === 'group-avatar') {
|
||||
const conversationId = message.get('conversationid');
|
||||
const conversationId = message.get('conversationId');
|
||||
const conversation = ConversationController.get(conversationId);
|
||||
if (!conversation) {
|
||||
logger.warn("_addAttachmentToMessage: conversation didn't exist");
|
||||
return;
|
||||
}
|
||||
|
||||
const existingAvatar = conversation.get('avatar');
|
||||
|
@ -375,11 +376,13 @@ async function _addAttachmentToMessage(message, attachment, { type, index }) {
|
|||
await Signal.Migrations.deleteAttachmentData(existingAvatar.path);
|
||||
}
|
||||
|
||||
const data = await Signal.Migrations.loadAttachmentData(attachment.path);
|
||||
const loadedAttachment = await Signal.Migrations.loadAttachmentData(
|
||||
attachment
|
||||
);
|
||||
conversation.set({
|
||||
avatar: {
|
||||
...attachment,
|
||||
hash: await computeHash(data),
|
||||
hash: await computeHash(loadedAttachment.data),
|
||||
},
|
||||
});
|
||||
await Signal.Data.updateConversation(
|
||||
|
|
Loading…
Reference in a new issue