Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: iOS library prevents creating one-person groups, which should be allowed #330

Closed
bwcDvorak opened this issue Apr 30, 2024 · 0 comments · Fixed by #334
Closed

Bug: iOS library prevents creating one-person groups, which should be allowed #330

bwcDvorak opened this issue Apr 30, 2024 · 0 comments · Fixed by #334
Labels
enhancement New feature or request Partner Support

Comments

@bwcDvorak
Copy link
Contributor

Describe the bug

Bug was reported in this comment about a different issue.

Creating a group where the creator is the only member is allowed, but our iOS library prevents doing so.

There is a guard against creating empty groups in the ios lib

public func newGroup(with addresses: [String], permissions: GroupPermissions = .everyoneIsAdmin) async throws -> Group {
guard let v3Client = client.v3Client else {
throw GroupError.alphaMLSNotEnabled
}
if addresses.isEmpty {
throw GroupError.emptyCreation
}
if addresses.first(where: { $0.lowercased() == client.address.lowercased() }) != nil {
throw GroupError.memberCannotBeSelf
}

public enum GroupError: Error, CustomStringConvertible {
case alphaMLSNotEnabled, emptyCreation, memberCannotBeSelf, memberNotRegistered([String]), groupsRequireMessagePassed, notSupportedByGroups
public var description: String {
switch self {
case .alphaMLSNotEnabled:
return "GroupError.alphaMLSNotEnabled"
case .emptyCreation:
return "GroupError.emptyCreation you cannot create an empty group"
case .memberCannotBeSelf:
return "GroupError.memberCannotBeSelf you cannot add yourself to a group"
case .memberNotRegistered(let array):
return "GroupError.memberNotRegistered members not registered: \(array.joined(separator: ", "))"
case .groupsRequireMessagePassed:
return "GroupError.groupsRequireMessagePassed you cannot call this method without passing a message instead of an envelope"
case .notSupportedByGroups:
return "GroupError.notSupportedByGroups this method is not supported by groups"
}
}
}

Expected behavior

Allow creation of creator-only groups.

Steps to reproduce the bug

No response

@bwcDvorak bwcDvorak added bug Something isn't working Partner Support labels Apr 30, 2024
@nplasterer nplasterer added enhancement New feature or request and removed bug Something isn't working labels Apr 30, 2024
@bwcDvorak bwcDvorak changed the title Bug: iOS library prevents Bug: iOS library prevents creating one-person groups, which should be allowed Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Partner Support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants