From 17ae0ed3eef54d96bd179ff7fec0540cf3024748 Mon Sep 17 00:00:00 2001 From: ᴜɴᴋɴᴡᴏɴ Date: Sat, 29 Feb 2020 16:29:17 +0800 Subject: conf: overhaul settings (#5953) * Overhaul cache settings * Overhaul HTTP settings * conf: overhaul more settings * log: make LGTM happy * travis: upload report to Codecov * Add codecov.yml --- internal/db/user.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'internal/db/user.go') diff --git a/internal/db/user.go b/internal/db/user.go index adaac99b..603f1905 100644 --- a/internal/db/user.go +++ b/internal/db/user.go @@ -216,7 +216,7 @@ func (u *User) GenerateActivateCode() string { // CustomAvatarPath returns user custom avatar file path. func (u *User) CustomAvatarPath() string { - return filepath.Join(conf.AvatarUploadPath, com.ToStr(u.ID)) + return filepath.Join(conf.Picture.AvatarUploadPath, com.ToStr(u.ID)) } // GenerateRandomAvatar generates a random avatar for user. @@ -262,7 +262,7 @@ func (u *User) RelAvatarLink() string { return defaultImgUrl } return fmt.Sprintf("%s/%s/%d", conf.Server.Subpath, USER_AVATAR_URL_PREFIX, u.ID) - case conf.DisableGravatar: + case conf.Picture.DisableGravatar: if !com.IsExist(u.CustomAvatarPath()) { if err := u.GenerateRandomAvatar(); err != nil { log.Error("GenerateRandomAvatar: %v", err) @@ -341,7 +341,7 @@ func (u *User) UploadAvatar(data []byte) error { return fmt.Errorf("decode image: %v", err) } - _ = os.MkdirAll(conf.AvatarUploadPath, os.ModePerm) + _ = os.MkdirAll(conf.Picture.AvatarUploadPath, os.ModePerm) fw, err := os.Create(u.CustomAvatarPath()) if err != nil { return fmt.Errorf("create custom avatar directory: %v", err) -- cgit v1.2.3