Remove archive conversation

pull/1109/head
Vincent 5 years ago
parent 72c5db52aa
commit 3ab2b550e4

@ -641,6 +641,54 @@
const ev = new Event('message');
ev.confirm = () => {};
const convo = await ConversationController.getOrCreateAndWait(
groupId,
'group'
);
if (convo.isClosedGroup()) {
// when removing, remove all pubkeys associated with this
// device to avoid sync delay issues and invalid group settings
// await window.libloki.storage.getPairedDevicesFor()
const allPubkeys = members;
// for each pubkey, get its paired devices
// we want to find all current members,
// and subtract members to get members to remove
// membersToRemove = currentMembers - newMembers
// membersToAdd
// first, get members to remove.
// then for each user to remove, find its devices
// if pubkey already in devices to remove, skip
const currentMembers = convo.attributes.members;
const membersToRemove = currentMembers.filter(member => !_.includes(members, member));
console.log('[vince] members:', members);
console.log('[vince] currentMembers:', currentMembers);
console.log('[vince] membersToRemove:', membersToRemove);
allPubkeys.forEach(pubkey => {
});
const pairedDevices = 5;
console.log('[vince] this.members:', this.get('members'));
console.log('[vince] providedGroupUpdate:', providedGroupUpdate);
console.log('[vince] groupUpdate:', groupUpdate);
console.log('[vince] doUpdateGroup: members:', members);
}
ev.data = {
source: ourKey,
timestamp: Date.now(),
@ -655,11 +703,6 @@
},
};
const convo = await ConversationController.getOrCreateAndWait(
groupId,
'group'
);
if (convo.isPublic()) {
const API = await convo.getPublicSendData();

@ -165,6 +165,22 @@
// Close group leaving
if (conversation.isClosedGroup()) {
await conversation.leaveGroup();
const deviceIds = await textsecure.storage.protocol.getDeviceIds(id);
await Promise.all(
deviceIds.map(deviceId => {
const address = new libsignal.SignalProtocolAddress(id, deviceId);
const sessionCipher = new libsignal.SessionCipher(
textsecure.storage.protocol,
address
);
return sessionCipher.deleteAllSessionsForDevice();
})
);
} else if (conversation.isPublic()) {
const channelAPI = await conversation.getPublicSendData();
if (channelAPI === null) {

@ -2235,6 +2235,10 @@
});
message.set({ id });
console.log('[vince] conversations.js --> groupUpdate:', groupUpdate);
const options = this.getSendOptions();
message.send(
this.wrapSend(
@ -2271,31 +2275,33 @@
if (this.get('type') === 'group') {
const groupNumbers = this.getRecipients();
this.set({ left: true });
await window.Signal.Data.updateConversation(this.id, this.attributes, {
Conversation: Whisper.Conversation,
});
const message = this.messageCollection.add({
group_update: { left: 'You' },
conversationId: this.id,
type: 'outgoing',
sent_at: now,
received_at: now,
});
const id = await window.Signal.Data.saveMessage(message.attributes, {
Message: Whisper.Message,
});
message.set({ id });
// await window.Signal.Data.updateConversation(this.id, this.attributes, {
// Conversation: Whisper.Conversation,
// });
const options = this.getSendOptions();
message.send(
this.wrapSend(
textsecure.messaging.leaveGroup(this.id, groupNumbers, options)
)
);
// const message = this.messageCollection.add({
// group_update: { left: 'You' },
// conversationId: this.id,
// type: 'outgoing',
// sent_at: now,
// received_at: now,
// });
// const id = await window.Signal.Data.saveMessage(message.attributes, {
// Message: Whisper.Message,
// });
// message.set({ id });
// const options = this.getSendOptions();
// message.send(
// this.wrapSend(
// textsecure.messaging.leaveGroup(this.id, groupNumbers, options)
// )
// );
this.updateTextInputState();
// this.updateTextInputState();
}
},

@ -508,13 +508,13 @@ export class ConversationHeader extends React.Component<Props> {
// hasNickname && (
// <MenuItem onClick={onClearNickname}>{i18n('clearNickname')}</MenuItem>
// );
const archiveConversationMenuItem = isArchived ? (
<MenuItem onClick={onMoveToInbox}>
{i18n('moveConversationToInbox')}
</MenuItem>
) : (
<MenuItem onClick={onArchive}>{i18n('archiveConversation')}</MenuItem>
);
// const archiveConversationMenuItem = isArchived ? (
// <MenuItem onClick={onMoveToInbox}>
// {i18n('moveConversationToInbox')}
// </MenuItem>
// ) : (
// <MenuItem onClick={onArchive}>{i18n('archiveConversation')}</MenuItem>
// );
return (
<React.Fragment>
@ -526,7 +526,7 @@ export class ConversationHeader extends React.Component<Props> {
{blockHandlerMenuItem}
{/* {changeNicknameMenuItem}
{clearNicknameMenuItem} */}
{archiveConversationMenuItem}
{/* {archiveConversationMenuItem} */}
</React.Fragment>
);
}

Loading…
Cancel
Save