Drop 'group leave' messages if sender is not currently in group
This commit is contained in:
parent
acf95f4745
commit
06333aef10
1 changed files with 16 additions and 6 deletions
|
@ -2298,18 +2298,28 @@
|
||||||
attributes.left = false;
|
attributes.left = false;
|
||||||
}
|
}
|
||||||
} else if (dataMessage.group.type === GROUP_TYPES.QUIT) {
|
} else if (dataMessage.group.type === GROUP_TYPES.QUIT) {
|
||||||
if (ConversationController.get(source || sourceUuid).isMe()) {
|
const sender = ConversationController.get(source || sourceUuid);
|
||||||
|
const inGroup = Boolean(
|
||||||
|
sender &&
|
||||||
|
(conversation.get('members') || []).includes(sender.id)
|
||||||
|
);
|
||||||
|
if (!inGroup) {
|
||||||
|
const senderString = sender ? sender.idForLogging() : null;
|
||||||
|
window.log.info(
|
||||||
|
`Got 'left' message from someone not in group: ${senderString}. Dropping.`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sender.isMe()) {
|
||||||
attributes.left = true;
|
attributes.left = true;
|
||||||
groupUpdate = { left: 'You' };
|
groupUpdate = { left: 'You' };
|
||||||
} else {
|
} else {
|
||||||
const myConversation = ConversationController.get(
|
groupUpdate = { left: sender.get('id') };
|
||||||
source || sourceUuid
|
|
||||||
);
|
|
||||||
groupUpdate = { left: myConversation.get('id') };
|
|
||||||
}
|
}
|
||||||
attributes.members = _.without(
|
attributes.members = _.without(
|
||||||
conversation.get('members'),
|
conversation.get('members'),
|
||||||
ConversationController.get(source || sourceUuid).get('id')
|
sender.get('id')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue