diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-02-29 16:29:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-29 16:29:17 +0800 |
commit | 17ae0ed3eef54d96bd179ff7fec0540cf3024748 (patch) | |
tree | a9111282717da16feb83baf352ffb2ee5178ca0d /internal/db/user.go | |
parent | d59b0f6ff7ee24d94eaa5ad68173405faea6a81c (diff) |
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
Diffstat (limited to 'internal/db/user.go')
-rw-r--r-- | internal/db/user.go | 6 |
1 files changed, 3 insertions, 3 deletions
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) |