Commit 9a994fd7 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Improve error when attempting to create a group with the system user.

parent 11101c52
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
### Changed
- Size limit for status messages increased from 128 to 2048 characters.
- Improve unfiltered group listings responses.
- Improve error when attempting to create a group with the system user.

## [3.4.0] - 2021-07-08
### Added
+2 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ var (
	ErrGroupLastSuperadmin    = errors.New("user is last group superadmin")
	ErrGroupUserInvalidCursor = errors.New("group user cursor invalid")
	ErrUserGroupInvalidCursor = errors.New("user group cursor invalid")
	ErrGroupCreatorInvalid    = errors.New("group creator user ID not valid")
)

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

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) {
	if userID == uuid.Nil {
		logger.Panic("This function must be used with non-system user ID.")
		return nil, ErrGroupCreatorInvalid
	}

	state := 1