From c7e5760c4c18d5f36e46b52c32be1f18d2f92671 Mon Sep 17 00:00:00 2001 From: Noah Date: Thu, 8 Sep 2022 21:52:50 -0700 Subject: [PATCH] More private avatars more places --- pkg/controller/photo/view.go | 3 +++ web/templates/partials/user_avatar.html | 19 +++++++++++++++++++ web/templates/photo/gallery.html | 20 ++++---------------- web/templates/photo/permalink.html | 18 +++--------------- 4 files changed, 29 insertions(+), 31 deletions(-) diff --git a/pkg/controller/photo/view.go b/pkg/controller/photo/view.go index 6ddb52a..b72687e 100644 --- a/pkg/controller/photo/view.go +++ b/pkg/controller/photo/view.go @@ -90,6 +90,9 @@ func View() http.HandlerFunc { } commentLikeMap := models.MapLikes(currentUser, "comments", commentIDs) + // Populate the user relationships in these comments. + models.SetUserRelationshipsInComments(currentUser, comments) + // Is the current user subscribed to notifications on this thread? _, isSubscribed := models.IsSubscribed(currentUser, "photos", photo.ID) diff --git a/web/templates/partials/user_avatar.html b/web/templates/partials/user_avatar.html index df33ede..9a9ba45 100644 --- a/web/templates/partials/user_avatar.html +++ b/web/templates/partials/user_avatar.html @@ -1,5 +1,24 @@ + +{{define "avatar-24x24"}} +
+ + {{if .ProfilePhoto.ID}} + {{if and (eq .ProfilePhoto.Visibility "private") (not .UserRelationship.IsPrivateGranted)}} + + {{else if and (eq .ProfilePhoto.Visibility "friends") (not .UserRelationship.IsFriend)}} + + {{else}} + + {{end}} + {{else}} + + {{end}} + +
+{{end}} + {{define "avatar-48x48"}}
diff --git a/web/templates/photo/gallery.html b/web/templates/photo/gallery.html index 1890725..27d7447 100644 --- a/web/templates/photo/gallery.html +++ b/web/templates/photo/gallery.html @@ -305,14 +305,8 @@ {{if $Root.UserMap.Has .UserID}} {{$Owner := $Root.UserMap.Get .UserID}}