Browse Source

提交代码,解决用户图像更新问题

Signed-off-by: zouap <zouap@pcl.ac.cn>
pull/3435/head
zouap 2 years ago
parent
commit
437b465f31
2 changed files with 7 additions and 2 deletions
  1. +6
    -1
      models/user.go
  2. +1
    -1
      routers/repo/grampus.go

+ 6
- 1
models/user.go View File

@@ -16,6 +16,7 @@ import (
"fmt"
_ "image/jpeg" // Needed for jpeg support
"image/png"
"math/rand"
"os"
"path/filepath"
"regexp"
@@ -495,7 +496,11 @@ func (u *User) RealSizedAvatarLink(size int) string {
// may either be a sub-URL to this site, or a full URL to an external avatar
// service.
func (u *User) RelAvatarLink() string {
return u.SizedRelAvatarLink(base.DefaultAvatarSize)
append := ""
if u.Avatar != ""{
append = "?" + fmt.Sprint(rand.Intn(100))
}
return u.SizedRelAvatarLink(base.DefaultAvatarSize) + append
}

// AvatarLink returns user avatar absolute link.


+ 1
- 1
routers/repo/grampus.go View File

@@ -1239,7 +1239,7 @@ func GrampusTrainJobShow(ctx *context.Context) {
return
}
task.ContainerIp = ""
task.User, _ = models.GetUserByID(task.UserID)
if task.DeletedAt.IsZero() { //normal record
result, err := grampus.GetJob(task.JobID)
if err != nil {


Loading…
Cancel
Save