Ignore group updates from before the thread was created

This commit is contained in:
Niels Andriesse 2021-01-11 16:10:05 +11:00
parent 2f906d8bb2
commit 284205303f
1 changed files with 4 additions and 0 deletions

View File

@ -269,6 +269,10 @@ extension MessageReceiver {
}
let group = thread.groupModel
let oldMembers = group.groupMemberIds
// Check that the message isn't from before the group was created
guard Double(message.sentTimestamp!) > thread.creationDate.timeIntervalSince1970 else {
return SNLog("Ignoring closed group update from before thread was created.")
}
// Check that the sender is a member of the group (before the update)
guard Set(group.groupMemberIds).contains(message.sender!) else {
return SNLog("Ignoring closed group update message from non-member.")