fix display name and avatar not being updated when message from secondary

pull/1223/head
Audric Ackermann 5 years ago
parent ed48818867
commit 15b8600e25
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -644,8 +644,6 @@
confirm: () => {},
};
const recipients = _.union(convo.get('members'), members);
await window.NewReceiver.onGroupReceived(ev);

@ -70,12 +70,20 @@ export async function updateProfile(
newProfile.avatar = null;
}
await conversation.setLokiProfile(newProfile);
if (conversation.isSecondaryDevice()) {
const primaryConversation = await conversation.getPrimaryConversation();
await primaryConversation.setLokiProfile(newProfile);
}
const allUserDevices = await MultiDeviceProtocol.getAllDevices(
conversation.id
);
const { ConversationController } = window;
await Promise.all(
allUserDevices.map(async device => {
const conv = await ConversationController.getOrCreateAndWait(
device.key,
'private'
);
await conv.setLokiProfile(newProfile);
})
);
}
function cleanAttachment(attachment: any) {

@ -13,18 +13,15 @@ async function handleGroups(
group: any,
source: any
): Promise<any> {
const textsecure = window.textsecure;
const GROUP_TYPES = SignalService.GroupContext.Type;
// TODO: this should be primary device id!
const ourNumber = textsecure.storage.user.getNumber();
let groupUpdate = null;
// conversation attributes
const attributes: any = {
type: 'group',
groupId: group.id,
...conversation.attributes,
};
const oldMembers = conversation.get('members');
@ -54,15 +51,21 @@ async function handleGroups(
// Check if anyone got kicked:
const removedMembers = _.difference(oldMembers, attributes.members);
const isOurDeviceMap = await Promise.all(
removedMembers.map(async member =>
MultiDeviceProtocol.isOurDevice(member)
)
);
const ourDeviceWasRemoved = isOurDeviceMap.includes(true);
if (removedMembers.includes(ourNumber)) {
if (ourDeviceWasRemoved) {
groupUpdate.kicked = 'You';
attributes.isKickedFromGroup = true;
} else if (removedMembers.length) {
groupUpdate.kicked = removedMembers;
}
} else if (group.type === GROUP_TYPES.QUIT) {
if (source === ourNumber) {
if (await MultiDeviceProtocol.isOurDevice(source)) {
attributes.left = true;
groupUpdate = { left: 'You' };
} else {

@ -105,8 +105,6 @@ export class SessionProtocol {
public static async sendSessionRequestIfNeeded(
pubkey: PubKey
): Promise<void> {
const { ConversationController } = window;
if (
(await SessionProtocol.hasSession(pubkey)) ||
(await SessionProtocol.hasSentSessionRequest(pubkey))

Loading…
Cancel
Save