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'
@ -667,11 +666,30 @@
// 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)); const membersToRemove = currentMembers.filter(
member => !_.includes(members, member)
);
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
// console.log('[vince] members:', members);
// console.log('[vince] currentMembers:', currentMembers);
// console.log('[vince] membersToRemove:', membersToRemove); // For each of allMembersToRemove,
// if you exist in members,
// allPubkeys.forEach(pubkey => { // allPubkeys.forEach(pubkey => {
@ -683,10 +701,12 @@
// 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,

@ -184,11 +184,6 @@
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