diff --git a/models/compat/wakatime/v1/user.go b/models/compat/wakatime/v1/user.go index a6314782..10f0c053 100644 --- a/models/compat/wakatime/v1/user.go +++ b/models/compat/wakatime/v1/user.go @@ -1,8 +1,11 @@ package v1 import ( - "github.com/muety/wakapi/models" + "fmt" "time" + + "github.com/muety/wakapi/config" + "github.com/muety/wakapi/models" ) const DefaultWakaUserDisplayName = "Anonymous User" @@ -28,6 +31,7 @@ type User struct { Website string `json:"website"` CreatedAt models.CustomTime `json:"created_at"` ModifiedAt models.CustomTime `json:"modified_at"` + Photo string `json:"photo"` } func NewFromUser(user *models.User) *User { @@ -36,14 +40,17 @@ func NewFromUser(user *models.User) *User { tz = user.Location } + config := config.Get() + return &User{ ID: user.ID, - DisplayName: DefaultWakaUserDisplayName, + DisplayName: user.ID, Email: user.Email, TimeZone: tz, Username: user.ID, CreatedAt: user.CreatedAt, ModifiedAt: user.CreatedAt, + Photo: fmt.Sprintf("%s%s/%s", config.Server.GetPublicUrl(), config.Server.BasePath, user.AvatarURL(config.App.AvatarURLTemplate)), } }