Include sender in group update notifications

This commit is contained in:
Scott Nonnenberg 2020-03-26 14:47:35 -07:00
parent d88c21e5b6
commit 71436d18e2
28 changed files with 1016 additions and 472 deletions

View file

@ -422,21 +422,39 @@ async function _addAttachmentToMessage(message, attachment, { type, index }) {
return;
}
const existingAvatar = conversation.get('avatar');
if (existingAvatar && existingAvatar.path) {
await Signal.Migrations.deleteAttachmentData(existingAvatar.path);
}
const loadedAttachment = await Signal.Migrations.loadAttachmentData(
attachment
);
const hash = await computeHash(loadedAttachment.data);
const existingAvatar = conversation.get('avatar');
if (existingAvatar) {
if (existingAvatar.hash === hash) {
logger.info(
'_addAttachmentToMessage: Group avatar hash matched; not replacing group avatar'
);
return;
}
await Signal.Migrations.deleteAttachmentData(existingAvatar.path);
}
conversation.set({
avatar: {
...attachment,
hash: await computeHash(loadedAttachment.data),
hash,
},
});
Signal.Data.updateConversation(conversationId, conversation.attributes);
message.set({
group_update: {
...message.get('group_update'),
avatar: null,
avatarUpdated: true,
},
});
return;
}