Skip to content

Commit 9a994fd

Browse files
committed
Improve error when attempting to create a group with the system user.
1 parent 11101c5 commit 9a994fd

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
77
### Changed
88
- Size limit for status messages increased from 128 to 2048 characters.
99
- Improve unfiltered group listings responses.
10+
- Improve error when attempting to create a group with the system user.
1011

1112
## [3.4.0] - 2021-07-08
1213
### Added

server/core_group.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ var (
5151
ErrGroupLastSuperadmin = errors.New("user is last group superadmin")
5252
ErrGroupUserInvalidCursor = errors.New("group user cursor invalid")
5353
ErrUserGroupInvalidCursor = errors.New("user group cursor invalid")
54+
ErrGroupCreatorInvalid = errors.New("group creator user ID not valid")
5455
)
5556

5657
type groupListCursor struct {
@@ -74,7 +75,7 @@ func (c *groupListCursor) GetUpdateTime() time.Time {
7475

7576
func CreateGroup(ctx context.Context, logger *zap.Logger, db *sql.DB, userID uuid.UUID, creatorID uuid.UUID, name, lang, desc, avatarURL, metadata string, open bool, maxCount int) (*api.Group, error) {
7677
if userID == uuid.Nil {
77-
logger.Panic("This function must be used with non-system user ID.")
78+
return nil, ErrGroupCreatorInvalid
7879
}
7980

8081
state := 1

0 commit comments

Comments
 (0)