profile: use name or fallback for profile page

This commit is contained in:
Torkel Ödegaard
2017-12-15 13:06:11 +01:00
parent fdf4bad1b7
commit 2797e8e2d0
2 changed files with 12 additions and 2 deletions
+10
View File
@@ -170,6 +170,16 @@ func (u *SignedInUser) ShouldUpdateLastSeenAt() bool {
return u.UserId > 0 && time.Since(u.LastSeenAt) > time.Minute*5
}
func (u *SignedInUser) NameOrFallback() string {
if u.Name != "" {
return u.Name
} else if u.Login != "" {
return u.Login
} else {
return u.Email
}
}
type UpdateUserLastSeenAtCommand struct {
UserId int64
}