mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-31 15:21:00 +08:00
Move almost all functions' parameter db.Engine to context.Context (#19748)
* Move almost all functions' parameter db.Engine to context.Context * remove some unnecessary wrap functions
This commit is contained in:
@ -26,12 +26,7 @@ func (u *User) CustomAvatarRelativePath() string {
|
||||
}
|
||||
|
||||
// GenerateRandomAvatar generates a random avatar for user.
|
||||
func GenerateRandomAvatar(u *User) error {
|
||||
return GenerateRandomAvatarCtx(db.DefaultContext, u)
|
||||
}
|
||||
|
||||
// GenerateRandomAvatarCtx generates a random avatar for user.
|
||||
func GenerateRandomAvatarCtx(ctx context.Context, u *User) error {
|
||||
func GenerateRandomAvatar(ctx context.Context, u *User) error {
|
||||
seed := u.Email
|
||||
if len(seed) == 0 {
|
||||
seed = u.Name
|
||||
@ -82,7 +77,7 @@ func (u *User) AvatarLinkWithSize(size int) string {
|
||||
|
||||
if useLocalAvatar {
|
||||
if u.Avatar == "" && autoGenerateAvatar {
|
||||
if err := GenerateRandomAvatar(u); err != nil {
|
||||
if err := GenerateRandomAvatar(db.DefaultContext, u); err != nil {
|
||||
log.Error("GenerateRandomAvatar: %v", err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user