Fix messages from secondary device not being mapped correctly to their primary device.

Fix creating closed groups from secondary device.
Fix primary device showing up in create group dialog.
pull/834/head
Mikunj Varsani 5 years ago
parent 746456200a
commit e1d06fc9be

@ -763,9 +763,10 @@
const ev = new Event('group'); const ev = new Event('group');
const ourKey = textsecure.storage.user.getNumber(); const primaryDeviceKey =
window.storage.get('primaryDevicePubKey') ||
const allMembers = [ourKey, ...members]; textsecure.storage.user.getNumber();
const allMembers = [primaryDeviceKey, ...members];
ev.groupDetails = { ev.groupDetails = {
id: groupId, id: groupId,
@ -794,7 +795,7 @@
window.friends.friendRequestStatusEnum.friends window.friends.friendRequestStatusEnum.friends
); );
convo.updateGroupAdmins([ourKey]); convo.updateGroupAdmins([primaryDeviceKey]);
appView.openConversation(groupId, {}); appView.openConversation(groupId, {});
}; };

@ -2361,6 +2361,12 @@
await sendingDeviceConversation.onFriendRequestAccepted(); await sendingDeviceConversation.onFriendRequestAccepted();
} }
} }
// We need to map the original message source to the primary device
if (source !== ourNumber) {
message.set({ source: primarySource });
}
const id = await window.Signal.Data.saveMessage(message.attributes, { const id = await window.Signal.Data.saveMessage(message.attributes, {
Message: Whisper.Message, Message: Whisper.Message,
}); });

@ -55,8 +55,10 @@ export class SessionClosableOverlay extends React.Component<Props, State> {
const conversations = window.getConversations() || []; const conversations = window.getConversations() || [];
const conversationList = conversations.filter((conversation: any) => { const conversationList = conversations.filter((conversation: any) => {
// TODO: We need to handle the case with > 1 secondary device
const isOurDevice = conversation.isMe() || conversation.isOurConversation();
return ( return (
!conversation.isOurConversation() && !isOurDevice&&
conversation.isPrivate() && conversation.isPrivate() &&
!conversation.isSecondaryDevice() && !conversation.isSecondaryDevice() &&
conversation.isFriend() conversation.isFriend()

Loading…
Cancel
Save