diff --git a/pkg/controller/chat/chat.go b/pkg/controller/chat/chat.go index e60e6e9..3756c73 100644 --- a/pkg/controller/chat/chat.go +++ b/pkg/controller/chat/chat.go @@ -7,6 +7,7 @@ import ( "time" "code.nonshy.com/nonshy/website/pkg/config" + "code.nonshy.com/nonshy/website/pkg/models" "code.nonshy.com/nonshy/website/pkg/photo" "code.nonshy.com/nonshy/website/pkg/session" "code.nonshy.com/nonshy/website/pkg/templates" @@ -51,10 +52,19 @@ func Landing() http.HandlerFunc { return } + // Avatar URL - masked if non-public. + avatar := photo.URLPath(currentUser.ProfilePhoto.CroppedFilename) + switch currentUser.ProfilePhoto.Visibility { + case models.PhotoPrivate: + avatar = "/static/img/shy-private.png" + case models.PhotoFriends: + avatar = "/static/img/shy-friends.png" + } + // Create the JWT claims. claims := Claims{ IsAdmin: currentUser.IsAdmin, - Avatar: photo.URLPath(currentUser.ProfilePhoto.CroppedFilename), + Avatar: avatar, ProfileURL: "/u/" + currentUser.Username, RegisteredClaims: jwt.RegisteredClaims{ // TODO: ExpiresAt 60 minutes to work around chat server reliability,