mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Debug
This commit is contained in:
parent
ff09ee3e79
commit
f1eba0ea7b
1 changed files with 11 additions and 4 deletions
|
@ -161,12 +161,19 @@ extension MessageSender {
|
|||
throw Error.invalidClosedGroupUpdate
|
||||
}
|
||||
let group = thread.groupModel
|
||||
// Send the update to the group
|
||||
let members = Set(group.groupMemberIds).subtracting(membersToRemove)
|
||||
let isCurrentUserAdmin = group.groupAdminIds.contains(getUserHexEncodedPublicKey())
|
||||
// Send the update to the group and generate + distribute a new encryption key pair if needed
|
||||
let closedGroupControlMessage = ClosedGroupControlMessage(kind: .membersRemoved(members: membersToRemove.map { Data(hex: $0) }))
|
||||
if isCurrentUserAdmin {
|
||||
let _ = MessageSender.sendNonDurably(closedGroupControlMessage, in: thread, using: transaction).done {
|
||||
try generateAndSendNewEncryptionKeyPair(for: groupPublicKey, to: members, using: transaction)
|
||||
}
|
||||
} else {
|
||||
MessageSender.send(closedGroupControlMessage, in: thread, using: transaction)
|
||||
}
|
||||
// Update the group
|
||||
let members = [String](Set(group.groupMemberIds).subtracting(membersToRemove))
|
||||
let newGroupModel = TSGroupModel(title: group.groupName, memberIds: members, image: nil, groupId: groupID, groupType: .closedGroup, adminIds: group.groupAdminIds)
|
||||
let newGroupModel = TSGroupModel(title: group.groupName, memberIds: [String](members), image: nil, groupId: groupID, groupType: .closedGroup, adminIds: group.groupAdminIds)
|
||||
thread.setGroupModel(newGroupModel, with: transaction)
|
||||
// Notify the user
|
||||
let updateInfo = group.getInfoStringAboutUpdate(to: newGroupModel)
|
||||
|
|
Loading…
Reference in a new issue