Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-7337: Added twig functions to get user preference #313

Merged
merged 3 commits into from
Jan 9, 2024

Conversation

mikadamczyk
Copy link
Contributor

@mikadamczyk mikadamczyk commented Dec 19, 2023

Question Answer
JIRA issue IBX-7337
Type feature
Target Ibexa version v4.6
BC breaks no

The first usage will be to check if the banner in the dashboard is hidden (https://github.com/ibexa/dashboard/pull/79)
Example usage:

{% if ibexa_has_user_preference('foo') is same as(true) %}

{% set foo = ibexa_get_user_preference_value('foo', 'false') %}

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly (main for features, the oldest supported for bugs).
  • Ran PHP CS Fixer for new PHP code (use $ composer fix-cs).
  • Asked for a review (ping @ibexa/engineering).

@mikadamczyk mikadamczyk requested a review from ViniTou December 22, 2023 11:06
public function hasUserPreference(string $identifier): bool
{
try {
$this->userPreferenceService->getUserPreference($identifier);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, as a follow-up, I'd prefer to have return $this->userPreferenceService->hasUserPreference($identifier); instead of exception-driven logic.

@alongosz alongosz requested a review from a team December 22, 2023 11:19
@mikadamczyk mikadamczyk force-pushed the IBX-7337-user-preference-twig-functions branch from 21fe05d to b606ab6 Compare January 8, 2024 10:42
Copy link

sonarqubecloud bot commented Jan 8, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@micszo micszo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified with sanities.

@micszo micszo removed their assignment Jan 9, 2024
@adamwojs adamwojs merged commit a94014f into main Jan 9, 2024
21 checks passed
@adamwojs adamwojs deleted the IBX-7337-user-preference-twig-functions branch January 9, 2024 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants