mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-28 06:33:50 +03:00
Remove unused KeyID
. (#29167)
`KeyID` is never set. (cherry picked from commit 155269fa586c41a268530c3bb56349e68e6761d7) Conflicts: models/user/email_address.go trivial context conflict
This commit is contained in:
parent
6eaabb1a9d
commit
52ef33b931
4 changed files with 12 additions and 17 deletions
|
@ -595,8 +595,6 @@ func GetOrgByID(ctx context.Context, id int64) (*Organization, error) {
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, user_model.ErrUserNotExist{
|
return nil, user_model.ErrUserNotExist{
|
||||||
UID: id,
|
UID: id,
|
||||||
Name: "",
|
|
||||||
KeyID: 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return u, nil
|
return u, nil
|
||||||
|
|
|
@ -33,7 +33,6 @@ func (err ErrUserAlreadyExist) Unwrap() error {
|
||||||
type ErrUserNotExist struct {
|
type ErrUserNotExist struct {
|
||||||
UID int64
|
UID int64
|
||||||
Name string
|
Name string
|
||||||
KeyID int64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsErrUserNotExist checks if an error is a ErrUserNotExist.
|
// IsErrUserNotExist checks if an error is a ErrUserNotExist.
|
||||||
|
@ -43,7 +42,7 @@ func IsErrUserNotExist(err error) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (err ErrUserNotExist) Error() string {
|
func (err ErrUserNotExist) Error() string {
|
||||||
return fmt.Sprintf("user does not exist [uid: %d, name: %s, keyid: %d]", err.UID, err.Name, err.KeyID)
|
return fmt.Sprintf("user does not exist [uid: %d, name: %s]", err.UID, err.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unwrap unwraps this error as a ErrNotExist error
|
// Unwrap unwraps this error as a ErrNotExist error
|
||||||
|
|
|
@ -847,7 +847,7 @@ func GetUserByID(ctx context.Context, id int64) (*User, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, ErrUserNotExist{id, "", 0}
|
return nil, ErrUserNotExist{UID: id}
|
||||||
}
|
}
|
||||||
return u, nil
|
return u, nil
|
||||||
}
|
}
|
||||||
|
@ -897,14 +897,14 @@ func GetPossibleUserByIDs(ctx context.Context, ids []int64) ([]*User, error) {
|
||||||
// GetUserByNameCtx returns user by given name.
|
// GetUserByNameCtx returns user by given name.
|
||||||
func GetUserByName(ctx context.Context, name string) (*User, error) {
|
func GetUserByName(ctx context.Context, name string) (*User, error) {
|
||||||
if len(name) == 0 {
|
if len(name) == 0 {
|
||||||
return nil, ErrUserNotExist{0, name, 0}
|
return nil, ErrUserNotExist{Name: name}
|
||||||
}
|
}
|
||||||
u := &User{LowerName: strings.ToLower(name), Type: UserTypeIndividual}
|
u := &User{LowerName: strings.ToLower(name), Type: UserTypeIndividual}
|
||||||
has, err := db.GetEngine(ctx).Get(u)
|
has, err := db.GetEngine(ctx).Get(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, ErrUserNotExist{0, name, 0}
|
return nil, ErrUserNotExist{Name: name}
|
||||||
}
|
}
|
||||||
return u, nil
|
return u, nil
|
||||||
}
|
}
|
||||||
|
@ -1045,7 +1045,7 @@ func ValidateCommitsWithEmails(ctx context.Context, oldCommits []*git.Commit) []
|
||||||
// GetUserByEmail returns the user object by given e-mail if exists.
|
// GetUserByEmail returns the user object by given e-mail if exists.
|
||||||
func GetUserByEmail(ctx context.Context, email string) (*User, error) {
|
func GetUserByEmail(ctx context.Context, email string) (*User, error) {
|
||||||
if len(email) == 0 {
|
if len(email) == 0 {
|
||||||
return nil, ErrUserNotExist{0, email, 0}
|
return nil, ErrUserNotExist{Name: email}
|
||||||
}
|
}
|
||||||
|
|
||||||
email = strings.ToLower(email)
|
email = strings.ToLower(email)
|
||||||
|
@ -1072,7 +1072,7 @@ func GetUserByEmail(ctx context.Context, email string) (*User, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, ErrUserNotExist{0, email, 0}
|
return nil, ErrUserNotExist{Name: email}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUser checks if a user already exists
|
// GetUser checks if a user already exists
|
||||||
|
@ -1083,7 +1083,7 @@ func GetUser(ctx context.Context, user *User) (bool, error) {
|
||||||
// GetUserByOpenID returns the user object by given OpenID if exists.
|
// GetUserByOpenID returns the user object by given OpenID if exists.
|
||||||
func GetUserByOpenID(ctx context.Context, uri string) (*User, error) {
|
func GetUserByOpenID(ctx context.Context, uri string) (*User, error) {
|
||||||
if len(uri) == 0 {
|
if len(uri) == 0 {
|
||||||
return nil, ErrUserNotExist{0, uri, 0}
|
return nil, ErrUserNotExist{Name: uri}
|
||||||
}
|
}
|
||||||
|
|
||||||
uri, err := openid.Normalize(uri)
|
uri, err := openid.Normalize(uri)
|
||||||
|
@ -1103,7 +1103,7 @@ func GetUserByOpenID(ctx context.Context, uri string) (*User, error) {
|
||||||
return GetUserByID(ctx, oid.UID)
|
return GetUserByID(ctx, oid.UID)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, ErrUserNotExist{0, uri, 0}
|
return nil, ErrUserNotExist{Name: uri}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAdminUser returns the first administrator
|
// GetAdminUser returns the first administrator
|
||||||
|
|
|
@ -154,8 +154,6 @@ func ReplaceInactivePrimaryEmail(ctx context.Context, oldEmail string, email *us
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return user_model.ErrUserNotExist{
|
return user_model.ErrUserNotExist{
|
||||||
UID: email.UID,
|
UID: email.UID,
|
||||||
Name: "",
|
|
||||||
KeyID: 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue