Testing w clg

pull/1109/head
Vincent 5 years ago
parent 3c977747a6
commit 4e6e573f18

@ -641,7 +641,6 @@
const ev = new Event('message'); const ev = new Event('message');
ev.confirm = () => {}; ev.confirm = () => {};
const convo = await ConversationController.getOrCreateAndWait( const convo = await ConversationController.getOrCreateAndWait(
groupId, groupId,
'group' 'group'
@ -650,43 +649,64 @@
if (convo.isClosedGroup()) { if (convo.isClosedGroup()) {
// when removing, remove all pubkeys associated with this // when removing, remove all pubkeys associated with this
// device to avoid sync delay issues and invalid group settings // device to avoid sync delay issues and invalid group settings
// await window.libloki.storage.getPairedDevicesFor() // await window.libloki.storage.getPairedDevicesFor()
const allPubkeys = members; const allPubkeys = members;
// for each pubkey, get its paired devices // for each pubkey, get its paired devices
// we want to find all current members, // we want to find all current members,
// and subtract members to get members to remove // and subtract members to get members to remove
// membersToRemove = currentMembers - newMembers // membersToRemove = currentMembers - newMembers
// membersToAdd // membersToAdd
// first, get members to remove. // first, get members to remove.
// then for each user to remove, find its devices // then for each user to remove, find its devices
// if pubkey already in devices to remove, skip // if pubkey already in devices to remove, skip
const currentMembers = convo.attributes.members; const currentMembers = convo.attributes.members;
const membersToRemove = currentMembers.filter(member => !_.includes(members, member));
// console.log('[vince] members:', members); const membersToRemove = currentMembers.filter(
// console.log('[vince] currentMembers:', currentMembers); member => !_.includes(members, member)
// console.log('[vince] membersToRemove:', membersToRemove); );
const allMembersToRemove = [];
membersToRemove.forEach(async member => {
const pairedDevices = await libloki.storage.getPairedDevicesFor(member);
allMembersToRemove.push(member, ...pairedDevices);
console.log('[vince] ALL DEVICES FOR THIS USER:', [member, ...pairedDevices]);
});
console.log('[vince] members:', members);
console.log('[vince] currentMembers:', currentMembers);
console.log('[vince] membersToRemove:', membersToRemove);
console.log('[vince] allMembersToRemove:', allMembersToRemove);
/// OOOOOH interesting. The member is already removed by the
// time this function is called
// For each of allMembersToRemove,
// if you exist in members,
// allPubkeys.forEach(pubkey => { // allPubkeys.forEach(pubkey => {
// }); // });
// const pairedDevices = 5; // const pairedDevices = 5;
// console.log('[vince] this.members:', this.get('members')); // console.log('[vince] this.members:', this.get('members'));
// console.log('[vince] providedGroupUpdate:', providedGroupUpdate); // console.log('[vince] providedGroupUpdate:', providedGroupUpdate);
// console.log('[vince] groupUpdate:', groupUpdate); // console.log('[vince] groupUpdate:', groupUpdate);
console.log('[vince] doUpdateGroup: members:', members); console.log('[vince] doUpdateGroup: members:', members);
}
// rturn early for testing
alert('return early for testing');
return;
}
ev.data = { ev.data = {
source: ourKey, source: ourKey,

@ -169,7 +169,7 @@
const deviceIds = await textsecure.storage.protocol.getDeviceIds(id); const deviceIds = await textsecure.storage.protocol.getDeviceIds(id);
console.log('[vince] deviceIds:', deviceIds); console.log('[vince] deviceIds:', deviceIds);
await Promise.all( await Promise.all(
deviceIds.map(deviceId => { deviceIds.map(deviceId => {
const address = new libsignal.SignalProtocolAddress(id, deviceId); const address = new libsignal.SignalProtocolAddress(id, deviceId);
@ -177,18 +177,13 @@
textsecure.storage.protocol, textsecure.storage.protocol,
address address
); );
console.log('[vince] address:', address); console.log('[vince] address:', address);
console.log('[vince] sessionCipher:', sessionCipher); console.log('[vince] sessionCipher:', sessionCipher);
return sessionCipher.deleteAllSessionsForDevice(); return sessionCipher.deleteAllSessionsForDevice();
}) })
); );
} else if (conversation.isPublic()) { } else if (conversation.isPublic()) {
const channelAPI = await conversation.getPublicSendData(); const channelAPI = await conversation.getPublicSendData();
if (channelAPI === null) { if (channelAPI === null) {

@ -2235,10 +2235,8 @@
}); });
message.set({ id }); message.set({ id });
console.log('[vince] conversations.js --> groupUpdate:', groupUpdate); console.log('[vince] conversations.js --> groupUpdate:', groupUpdate);
const options = this.getSendOptions(); const options = this.getSendOptions();
message.send( message.send(
this.wrapSend( this.wrapSend(
@ -2276,7 +2274,6 @@
const groupNumbers = this.getRecipients(); const groupNumbers = this.getRecipients();
this.set({ left: true }); this.set({ left: true });
// await window.Signal.Data.updateConversation(this.id, this.attributes, { // await window.Signal.Data.updateConversation(this.id, this.attributes, {
// Conversation: Whisper.Conversation, // Conversation: Whisper.Conversation,
// }); // });

@ -1,4 +1,4 @@
/* global Whisper, i18n, textsecure, _ */ /* global Whisper, i18n, textsecure, libloki, _ */
// eslint-disable-next-line func-names // eslint-disable-next-line func-names
(function() { (function() {
@ -153,6 +153,8 @@
if (!Array.isArray(this.existingMembers)) { if (!Array.isArray(this.existingMembers)) {
this.existingMembers = []; this.existingMembers = [];
} }
console.log('[vince] UpdateGroupMembersDialogView this AFTER', this);
} }
this.$el.focus(); this.$el.focus();
@ -183,13 +185,30 @@
const ourPK = textsecure.storage.user.getNumber(); const ourPK = textsecure.storage.user.getNumber();
const allMembers = window.Lodash.concat(newMembers, [ourPK]); const allMembers = window.Lodash.concat(newMembers, [ourPK]);
// We need to NOT trigger an group update if the list of member is the same. // We need to NOT trigger an group update if the list of member is the same.
const notPresentInOld = allMembers.filter( const notPresentInOld = allMembers.filter(
m => !this.existingMembers.includes(m) m => !this.existingMembers.includes(m)
); );
// Filter out all linked devices for cases in which one device
// exists in group, but hasn't yet synced with its other devices.
const notPresentInNew = this.existingMembers.filter( const notPresentInNew = this.existingMembers.filter(
m => !allMembers.includes(m) m => !allMembers.includes(m)
); );
// Get all devices for notPresentInNew
const allDevicesOfMembersToRemove = [];
notPresentInNew.forEach(async member => {
const pairedDevices = await libloki.storage.getPairedDevicesFor(member);
allDevicesOfMembersToRemove.push(member, ...pairedDevices);
});
const allToRemove = allDevicesOfMembersToRemove.filter(
m => this.existingMembers.includes(m)
);
// would be easer with _.xor but for some reason we do not have it // would be easer with _.xor but for some reason we do not have it
const xor = notPresentInNew.concat(notPresentInOld); const xor = notPresentInNew.concat(notPresentInOld);
if (xor.length === 0) { if (xor.length === 0) {
@ -200,12 +219,21 @@
return; return;
} }
window.doUpdateGroup( console.log('[vince] allDevicesOfMembersToRemove:', allDevicesOfMembersToRemove);
this.groupId, console.log('[vince] allMembers:', allMembers);
this.groupName, console.log('[vince] notPresentInOld:', notPresentInOld);
allMembers, console.log('[vince] notPresentInNew:', notPresentInNew);
this.avatarPath console.log('[vince] xor:', xor);
); console.log('[vince] allToRemove:', allToRemove);
alert('returning earlyyyy');
// window.doUpdateGroup(
// this.groupId,
// this.groupName,
// allMembers,
// this.avatarPath
// );
}, },
close() { close() {
this.remove(); this.remove();

@ -1427,12 +1427,10 @@ MessageReceiver.prototype.extend({
); );
} }
console.log('[vince] THIS IS A syncMessage:'); console.log('[vince] THIS IS A syncMessage:');
console.log('[vince] envelope:', envelope); console.log('[vince] envelope:', envelope);
console.log('[vince] syncMessage:', syncMessage); console.log('[vince] syncMessage:', syncMessage);
if (syncMessage.sent) { if (syncMessage.sent) {
const sentMessage = syncMessage.sent; const sentMessage = syncMessage.sent;
const to = sentMessage.message.group const to = sentMessage.message.group

Loading…
Cancel
Save