aboutsummaryrefslogtreecommitdiff
path: root/internal/route
diff options
context:
space:
mode:
Diffstat (limited to 'internal/route')
-rw-r--r--internal/route/api/v1/convert/convert.go2
-rw-r--r--internal/route/api/v1/user/user.go2
-rw-r--r--internal/route/user/home.go2
-rw-r--r--internal/route/user/setting.go5
4 files changed, 6 insertions, 5 deletions
diff --git a/internal/route/api/v1/convert/convert.go b/internal/route/api/v1/convert/convert.go
index bf5aabbd..04d4df33 100644
--- a/internal/route/api/v1/convert/convert.go
+++ b/internal/route/api/v1/convert/convert.go
@@ -120,7 +120,7 @@ func ToDeployKey(apiLink string, key *db.DeployKey) *api.DeployKey {
func ToOrganization(org *db.User) *api.Organization {
return &api.Organization{
ID: org.ID,
- AvatarUrl: org.AvatarLink(),
+ AvatarUrl: org.AvatarURL(),
UserName: org.Name,
FullName: org.FullName,
Description: org.Description,
diff --git a/internal/route/api/v1/user/user.go b/internal/route/api/v1/user/user.go
index 2b26a282..5852f660 100644
--- a/internal/route/api/v1/user/user.go
+++ b/internal/route/api/v1/user/user.go
@@ -40,7 +40,7 @@ func Search(c *context.APIContext) {
results[i] = &api.User{
ID: users[i].ID,
UserName: users[i].Name,
- AvatarUrl: users[i].AvatarLink(),
+ AvatarUrl: users[i].AvatarURL(),
FullName: markup.Sanitize(users[i].FullName),
}
if c.IsLogged {
diff --git a/internal/route/user/home.go b/internal/route/user/home.go
index a14572ed..5a2ebf8e 100644
--- a/internal/route/user/home.go
+++ b/internal/route/user/home.go
@@ -82,7 +82,7 @@ func retrieveFeeds(c *context.Context, ctxUser *db.User, userID int64, isProfile
c.Error(err, "get user by name")
return
}
- unameAvatars[act.ActUserName] = u.RelAvatarLink()
+ unameAvatars[act.ActUserName] = u.AvatarURLPath()
}
act.ActAvatar = unameAvatars[act.ActUserName]
diff --git a/internal/route/user/setting.go b/internal/route/user/setting.go
index 8c0e87c1..54771abf 100644
--- a/internal/route/user/setting.go
+++ b/internal/route/user/setting.go
@@ -27,6 +27,7 @@ import (
"gogs.io/gogs/internal/email"
"gogs.io/gogs/internal/form"
"gogs.io/gogs/internal/tool"
+ "gogs.io/gogs/internal/userutil"
)
const (
@@ -144,8 +145,8 @@ func UpdateAvatarSetting(c *context.Context, f form.Avatar, ctxUser *db.User) er
} else {
// No avatar is uploaded but setting has been changed to enable,
// generate a random one when needed.
- if ctxUser.UseCustomAvatar && !com.IsFile(ctxUser.CustomAvatarPath()) {
- if err := ctxUser.GenerateRandomAvatar(); err != nil {
+ if ctxUser.UseCustomAvatar && !com.IsFile(userutil.CustomAvatarPath(ctxUser.ID)) {
+ if err := userutil.GenerateRandomAvatar(ctxUser.ID, ctxUser.Name, ctxUser.Email); err != nil {
log.Error("generate random avatar [%d]: %v", ctxUser.ID, err)
}
}