Fix limited logged-out view profile picture

face-detect
Noah Petherbridge 2024-01-07 15:32:51 -08:00
parent 7a6b21fee5
commit 19006877a2
2 changed files with 6 additions and 2 deletions

View File

@ -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 != "" {

View File

@ -8,7 +8,11 @@
<div class="columns">
<div class="column is-narrow has-text-centered">
<figure class="profile-photo is-inline-block">
{{if or (not .CurrentUser) .IsExternalView}}
<img src="{{.User.VisibleAvatarURL nil}}" data-photo-id="{{.User.ProfilePhoto.ID}}">
{{else}}
<img src="{{.User.VisibleAvatarURL .CurrentUser}}" data-photo-id="{{.User.ProfilePhoto.ID}}">
{{end}}
<!-- CurrentUser can upload a new profile pic -->
{{if and .LoggedIn (eq .CurrentUser.ID .User.ID) (not .IsPrivate)}}