Skip to content

Commit

Permalink
fixed crash in create group request
Browse files Browse the repository at this point in the history
see #410
  • Loading branch information
Bernhard B committed Oct 3, 2023
1 parent 08959a9 commit fc2982c
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ const (
)

func (g GroupPermission) String() string {
return []string{"", "every-member", "only-admins"}[g]
switch g {
case DefaultGroupPermission:
return ""
case EveryMember:
return "every-member"
case OnlyAdmins:
return "only-admins"
}
return ""
}

func (g GroupPermission) FromString(input string) GroupPermission {
Expand All @@ -66,7 +74,17 @@ func (g GroupPermission) FromString(input string) GroupPermission {
}

func (g GroupLinkState) String() string {
return []string{"", "enabled", "enabled-with-approval", "disabled"}[g]
switch g {
case DefaultGroupLinkState:
return ""
case Enabled:
return "enabled"
case EnabledWithApproval:
return "enabled-with-approval"
case Disabled:
return "disabled"
}
return ""
}

func (g GroupLinkState) FromString(input string) GroupLinkState {
Expand Down

0 comments on commit fc2982c

Please sign in to comment.