Skip to content

Commit

Permalink
Merge pull request #10854 from nanaya/show-legacy-value
Browse files Browse the repository at this point in the history
More useful return type for user score legacy preference
  • Loading branch information
notbakaneko authored Jan 15, 2024
2 parents 22e0ba2 + 07ecf8a commit e298042
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/Libraries/Search/ScoreSearchParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ public static function fromArray(array $rawParams): static
return $params;
}

public static function showLegacyForUser(?User $user): bool
/**
* This returns value for isLegacy based on user preference
*/
public static function showLegacyForUser(?User $user): null | true
{
return $user?->userProfileCustomization?->legacy_score_only ?? UserProfileCustomization::DEFAULT_LEGACY_ONLY_ATTRIBUTE;
return $user?->userProfileCustomization?->legacy_score_only ?? UserProfileCustomization::DEFAULT_LEGACY_ONLY_ATTRIBUTE
? true
: null;
}

public function getCountryCode(): string
Expand Down

0 comments on commit e298042

Please sign in to comment.