Use anonymized avatars in chat for non-public profile pics
This commit is contained in:
parent
5e3e02ee33
commit
c4600ff6ce
|
@ -7,6 +7,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.nonshy.com/nonshy/website/pkg/config"
|
"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/photo"
|
||||||
"code.nonshy.com/nonshy/website/pkg/session"
|
"code.nonshy.com/nonshy/website/pkg/session"
|
||||||
"code.nonshy.com/nonshy/website/pkg/templates"
|
"code.nonshy.com/nonshy/website/pkg/templates"
|
||||||
|
@ -51,10 +52,19 @@ func Landing() http.HandlerFunc {
|
||||||
return
|
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.
|
// Create the JWT claims.
|
||||||
claims := Claims{
|
claims := Claims{
|
||||||
IsAdmin: currentUser.IsAdmin,
|
IsAdmin: currentUser.IsAdmin,
|
||||||
Avatar: photo.URLPath(currentUser.ProfilePhoto.CroppedFilename),
|
Avatar: avatar,
|
||||||
ProfileURL: "/u/" + currentUser.Username,
|
ProfileURL: "/u/" + currentUser.Username,
|
||||||
RegisteredClaims: jwt.RegisteredClaims{
|
RegisteredClaims: jwt.RegisteredClaims{
|
||||||
// TODO: ExpiresAt 60 minutes to work around chat server reliability,
|
// TODO: ExpiresAt 60 minutes to work around chat server reliability,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user