Fix bugs when comparing and creating pull request (#36144)

Backport #36166
This commit is contained in:
Lunny Xiao
2025-12-17 16:17:33 -08:00
committed by GitHub
parent 522cc25921
commit 79f4cd754b
7 changed files with 189 additions and 16 deletions

View File

@@ -1444,3 +1444,15 @@ func DisabledFeaturesWithLoginType(user *User) *container.Set[string] {
}
return &setting.Admin.UserDisabledFeatures
}
// GetUserOrOrgByName returns the user or org by name
func GetUserOrOrgByName(ctx context.Context, name string) (*User, error) {
var u User
has, err := db.GetEngine(ctx).Where("lower_name = ?", strings.ToLower(name)).Get(&u)
if err != nil {
return nil, err
} else if !has {
return nil, ErrUserNotExist{Name: name}
}
return &u, nil
}