mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-05 23:34:11 +02:00
changes
* move error-related code for groups to its own file * update group avatar logic remove unused/duplicate logic * update `FindGroupsOptions.ToConds()` allow passing `-1` as the `ParentGroupID`, meaning "find matching groups regardless of the parent group id" * add `DedupeBy` function to container module this removes duplicate items from a slice using a custom function * add `SliceMap` util works like javascripts's `Array.prototoype.map`, taking in a slice and transforming each element with the provided function * add group service functions included so far: - avatar uploading/deletion - group deletion - group creation - group moving (including moving item inside a group) - group update - team management - add team - remove team - update team permissions - recalculating team access (in event of group move) - group searching (only used in frontend/web components for now)
This commit is contained in:
1 parent
1246721523
commit
96feb682fe
11 files changed
+739
-90
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
)
|
||||
|
||||
type ErrGroupNotExist struct {
|
||||
ID int64
|
||||
}
|
||||
|
||||
// IsErrGroupNotExist checks if an error is a ErrCommentNotExist.
|
||||
func IsErrGroupNotExist(err error) bool {
|
||||
var errGroupNotExist ErrGroupNotExist
|
||||
ok := errors.As(err, &errGroupNotExist)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrGroupNotExist) Error() string {
|
||||
return fmt.Sprintf("group does not exist [id: %d]", err.ID)
|
||||
}
|
||||
|
||||
func (err ErrGroupNotExist) Unwrap() error {
|
||||
return util.ErrNotExist
|
||||
}
|
||||
|
||||
type ErrGroupTooDeep struct {
|
||||
ID int64
|
||||
}
|
||||
|
||||
func IsErrGroupTooDeep(err error) bool {
|
||||
var errGroupTooDeep ErrGroupTooDeep
|
||||
ok := errors.As(err, &errGroupTooDeep)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrGroupTooDeep) Error() string {
|
||||
return fmt.Sprintf("group has reached or exceeded the subgroup nesting limit [id: %d]", err.ID)
|
||||
}
|
||||
Reference in new issue
Block a user