1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Refactor user package (#33423)

and avoid global variables
This commit is contained in:
wxiaoguang
2025-01-29 07:14:35 +08:00
committed by GitHub
parent a9577e0808
commit 8c4f0f02ef
6 changed files with 59 additions and 52 deletions

View File

@@ -4,7 +4,6 @@
package user
import (
"strings"
"time"
"code.gitea.io/gitea/models/avatars"
@@ -27,7 +26,7 @@ func AvatarByUserName(ctx *context.Context) {
size := int(ctx.PathParamInt64("size"))
var user *user_model.User
if strings.ToLower(userName) != user_model.GhostUserLowerName {
if !user_model.IsGhostUserName(userName) {
var err error
if user, err = user_model.GetUserByName(ctx, userName); err != nil {
if user_model.IsErrUserNotExist(err) {