diff --git a/pkg/models/user.go b/pkg/models/user.go index 8eed924..16c66b8 100644 --- a/pkg/models/user.go +++ b/pkg/models/user.go @@ -559,6 +559,10 @@ 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 { + SetUserRelationships(currentUser, []*User{u}) + } + visibility := u.ProfilePhoto.Visibility if visibility == PhotoPrivate && !u.UserRelationship.IsPrivateGranted { // Private photo diff --git a/pkg/models/user_relationship.go b/pkg/models/user_relationship.go index d9d6dcf..ebaf141 100644 --- a/pkg/models/user_relationship.go +++ b/pkg/models/user_relationship.go @@ -5,6 +5,7 @@ package models // The zero-values should fail safely: in case the UserRelationship isn't populated correctly, // private profile pics show as private by default. type UserRelationship struct { + Computed bool // check whether the SetUserRelationships function has been run IsFriend bool // if true, a friends-only profile pic can show IsPrivateGranted bool // if true, a private profile pic can show IsInnerCirclePeer bool // if true, the current user is in the inner circle so may see circle-only profile picture