mirror of
https://github.com/go-gitea/gitea
synced 2024-11-18 16:14:26 +00:00
466facc009
- fix delete user but repository watches are not decreased
85 lines
2.3 KiB
Go
85 lines
2.3 KiB
Go
// Copyright 2015 The Gogs Authors. All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package models
|
|
|
|
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)
|
|
}
|
|
|
|
// __________ .__ __
|
|
// \______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
|
|
// | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
|
|
// | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ |
|
|
// |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____|
|
|
// \/ \/|__| \/ \/
|
|
|
|
type ErrRepoNotExist struct {
|
|
ID int64
|
|
UID int64
|
|
Name string
|
|
}
|
|
|
|
func IsErrRepoNotExist(err error) bool {
|
|
_, ok := err.(ErrRepoNotExist)
|
|
return ok
|
|
}
|
|
|
|
func (err ErrRepoNotExist) Error() string {
|
|
return fmt.Sprintf("repository does not exist [id: %d, uid: %d, name: %s]", err.ID, err.UID, err.Name)
|
|
}
|