Browse Source

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

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.12.2^2
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" "fmt"
_ "image/jpeg" // Needed for jpeg support _ "image/jpeg" // Needed for jpeg support
"image/png" "image/png"
"math/rand"
"os" "os"
"path/filepath" "path/filepath"
"regexp" "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 // may either be a sub-URL to this site, or a full URL to an external avatar
// service. // service.
func (u *User) RelAvatarLink() string { 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. // AvatarLink returns user avatar absolute link.


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

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


Loading…
Cancel
Save