Skip to content

Commit

Permalink
fix: cannot get preference for deleted user (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
luceos authored Oct 17, 2024
1 parent 0c1e8bb commit b76a0ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Api/AttachRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __invoke(PostSerializer $serializer, Post $post): ?Relationship

$viewCountry = $serializer->getActor()->can('fof-geoip.canSeeCountry');
$showFlagsFeatureEnabled = $this->settings->get('fof-geoip.showFlag');
$userPreference = $post->user->getPreference('showIPCountry');
$userPreference = $post->user?->getPreference('showIPCountry');

if ($viewCountry || ($showFlagsFeatureEnabled && $userPreference)) {
return $serializer->hasOne($post, BasicIPInfoSerializer::class, 'ip_info');
Expand Down

0 comments on commit b76a0ae

Please sign in to comment.