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

[CIVIC-1449] Fixed Automated list filters not being hidden. #1157

Merged
merged 5 commits into from
Dec 7, 2023

Conversation

mudrasamey
Copy link
Collaborator

@mudrasamey mudrasamey commented Nov 28, 2023

https://salsadigital.atlassian.net/browse/CIVIC-1449

Checklist before requesting a review

  • I have formatted the subject to include ticket number as [CS-123] Verb in past tense with dot at the end.
  • I have added a link to the issue tracker
  • I have provided information in Changed section about WHY something was done if this was not a normal implementation
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have run new and existing relevant tests locally with my
    changes, and they passed
  • I have provided screenshots, where applicable

Changed

  1. Based on the component setting unset the view filter for automated list

Screenshots

Screenshot 2023-11-28 at 10 05 49 AM Screenshot 2023-11-28 at 10 06 06 AM

@mudrasamey mudrasamey added the State: Needs review Pull requests needs a review from assigned developers label Nov 28, 2023
Copy link
Collaborator

@AlexSkrypnyk AlexSkrypnyk left a comment

Choose a reason for hiding this comment

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

@mudrasamey
Please see inline comments and update accordingly.

Also, please add Behat tests that demonstrate the case when:

  1. All filters selected
  2. Some filters selected
  3. None filters selected.

thank you

$show_filters = !empty(array_filter(explode(', ', $settings['filters_exp'])));
if (!$show_filters) {
// Exposed filters.
$exposed_filter = explode(', ', $settings['filters_exp']);
Copy link
Collaborator

Choose a reason for hiding this comment

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

$exposed_filters

if (!$show_filters) {
// Exposed filters.
$exposed_filter = explode(', ', $settings['filters_exp']);
$show_filters = !empty(array_filter($exposed_filter));
Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove this and just use the count($exposed_filters)>0

// Disable filters based on the component settings.
$view_filters = $view->display_handler->getOption('filters');
foreach ($view_filters as $key => $filter) {
if (isset($filter['exposed']) &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

replace

isset($filter['exposed']) &&
        $filter['exposed'] &&

with

!empty($filter['exposed'])

if ($show_filters) {
// Disable filters based on the component settings.
$view_filters = $view->display_handler->getOption('filters');
foreach ($view_filters as $key => $filter) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

replace $key with $filter_identifier

@AlexSkrypnyk AlexSkrypnyk added State: Requires more work Pull request was reviewed and reviver(s) asked to work further on the pull request and removed State: Needs review Pull requests needs a review from assigned developers labels Nov 28, 2023
@mudrasamey
Copy link
Collaborator Author

@AlexSkrypnyk i have made the changes as per your suggestion. I have also added supporting behat test

@AlexSkrypnyk AlexSkrypnyk changed the title [CIVIC-1449] Fixed automated list filter issue. [CIVIC-1449] Fixed Automated list filters not being hidden. Dec 5, 2023
@AlexSkrypnyk
Copy link
Collaborator

@mudrasamey
Thank you for making changes.

Could you please fix the code to make the CI pass. Thank you

@AlexSkrypnyk AlexSkrypnyk added State: Ready to be merged Pull request is ready to be merged (assigned after testing is complete) and removed State: Requires more work Pull request was reviewed and reviver(s) asked to work further on the pull request labels Dec 7, 2023
Copy link
Collaborator

@AlexSkrypnyk AlexSkrypnyk left a comment

Choose a reason for hiding this comment

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

@mudrasamey
Thank you for your contribution!

@AlexSkrypnyk AlexSkrypnyk enabled auto-merge (squash) December 7, 2023 06:32
@AlexSkrypnyk AlexSkrypnyk merged commit a1b968c into develop Dec 7, 2023
9 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/CIVIC-1449 branch December 7, 2023 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
State: Ready to be merged Pull request is ready to be merged (assigned after testing is complete)
Projects
None yet
2 participants