diff options
author | Unknwon <u@gogs.io> | 2015-03-17 21:51:39 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-03-17 21:51:39 -0400 |
commit | 466facc0097bf636b6a945a0daebb7c4c5c33c91 (patch) | |
tree | 614c2782ff5b59dd40cea9a9caadb93d46570258 /models/error.go | |
parent | 33894591a6d391674e938d018801d88d0011f0b7 (diff) | |
download | gitea-466facc0097bf636b6a945a0daebb7c4c5c33c91.tar.gz gitea-466facc0097bf636b6a945a0daebb7c4c5c33c91.zip |
#1067: Deleting users should remove them from collaborator lists
- fix delete user but repository watches are not decreased
Diffstat (limited to 'models/error.go')
-rw-r--r-- | models/error.go | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/models/error.go b/models/error.go index 6f1a366cb4..a434b8d6da 100644 --- a/models/error.go +++ b/models/error.go @@ -8,6 +8,59 @@ import ( "fmt" ) +// ____ ___ +// | | \______ ___________ +// | | / ___// __ \_ __ \ +// | | /\___ \\ ___/| | \/ +// |______//____ >\___ >__| +// \/ \/ + +type ErrUserOwnRepos struct { + UID int64 +} + +func IsErrUserOwnRepos(err error) bool { + _, ok := err.(ErrUserOwnRepos) + return ok +} + +func (err ErrUserOwnRepos) Error() string { + return fmt.Sprintf("user still has ownership of repositories: [uid: %d]", err.UID) +} + +type ErrUserHasOrgs struct { + UID int64 +} + +func IsErrUserHasOrgs(err error) bool { + _, ok := err.(ErrUserHasOrgs) + return ok +} + +func (err ErrUserHasOrgs) Error() string { + return fmt.Sprintf("user still has membership of organizations: [uid: %d]", err.UID) +} + +// ________ .__ __ .__ +// \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____ +// / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \ +// / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \ +// \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| / +// \/ /_____/ \/ \/ \/ \/ \/ + +type ErrLastOrgOwner struct { + UID int64 +} + +func IsErrLastOrgOwner(err error) bool { + _, ok := err.(ErrLastOrgOwner) + return ok +} + +func (err ErrLastOrgOwner) Error() string { + return fmt.Sprintf("user is the last member of owner team: [uid: %d]", err.UID) +} + // __________ .__ __ // \______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__. // | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | | |