From 19006877a2eff6f5f586fadd98fb7f2035dab1f8 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sun, 7 Jan 2024 15:32:51 -0800 Subject: [PATCH] Fix limited logged-out view profile picture --- pkg/models/user.go | 4 ++-- web/templates/account/profile.html | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/models/user.go b/pkg/models/user.go index 16c66b8..4e04af0 100644 --- a/pkg/models/user.go +++ b/pkg/models/user.go @@ -559,7 +559,7 @@ func (u *User) VisibleAvatarURL(currentUser *User) string { // // If the user has no profile photo, returns (false, PhotoPublic) which should manifest as the blue shy.png placeholder image. func (u *User) CanSeeProfilePicture(currentUser *User) (bool, PhotoVisibility) { - if !u.UserRelationship.Computed { + if !u.UserRelationship.Computed && currentUser != nil { SetUserRelationships(currentUser, []*User{u}) } @@ -570,7 +570,7 @@ func (u *User) CanSeeProfilePicture(currentUser *User) (bool, PhotoVisibility) { } else if visibility == PhotoFriends && !u.UserRelationship.IsFriend { // Friends only return false, visibility - } else if visibility == PhotoInnerCircle && !currentUser.IsInnerCircle() { + } else if visibility == PhotoInnerCircle && currentUser != nil && !currentUser.IsInnerCircle() { // Inner circle only return false, visibility } else if u.ProfilePhoto.CroppedFilename != "" { diff --git a/web/templates/account/profile.html b/web/templates/account/profile.html index c9f3888..4e9698d 100644 --- a/web/templates/account/profile.html +++ b/web/templates/account/profile.html @@ -8,7 +8,11 @@
+ {{if or (not .CurrentUser) .IsExternalView}} + + {{else}} + {{end}} {{if and .LoggedIn (eq .CurrentUser.ID .User.ID) (not .IsPrivate)}}