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

Issue #3340217 by vnech: "Dropdown" render element doesn't set non-existent option as "active" #3307

Merged
merged 2 commits into from
Feb 21, 2023

Conversation

nechai
Copy link
Contributor

@nechai nechai commented Feb 8, 2023

Problem

Warning
This issue related to our "Social Role Visibility" extension but can be reproduced without enabling it

If add any new group content visibility option to the flexible group (/admin/group/types/manage/flexible_group/fields/group.flexible_group.field_group_allowed_visibility/storage)
alt

enable "Enable posts for members" and choose only this option in "Group content visibility options" field due creating a group
alt

we get fatal error on group stream:
The website encountered an unexpected error. Please try again later.
TypeError: _socialbase_get_visibility_icon(): Argument #1 ($title) must be of type string, null given, called in /var/www/html/html/themes/contrib/socialbase/src/Plugin/Preprocess/FieldDropdown.php on line 24 in _socialbase_get_visibility_icon() (line 80 of themes/contrib/socialbase/socialbase.theme).
_socialbase_get_visibility_icon(NULL) (Line: 24)
Drupal\socialbase\Plugin\Preprocess\FieldDropdown->preprocess(Array, 'dropdown', Array) (Line: 1443)
Drupal\bootstrap\Bootstrap::preprocess(Array, 'dropdown', Array) (Line: 118)
bootstrap_preprocess(Array, 'dropdown', Array)
call_user_func_array('bootstrap_preprocess', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('dropdown', Array) (Line: 478)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 75)
__TwigTemplate_eb9ba40db22317197998c9eb3d0c03becd2232b767050d8a7e8d8c3b492eb7bb->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('themes/contrib/bootstrap/templates/field/field-multiple-value-form.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('field_multiple_value_form', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 56)
__TwigTemplate_4bd2fc9abe6f1201de01478feea0f592aec76b21ad47a86c81a3e344ce3087eb->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('themes/contrib/socialbase/templates/block/block--social-post.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('block', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 201)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 157)
Drupal\Core\Render\Renderer->Drupal\Core\Render{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 158)
Drupal\Core\Render\Renderer->renderPlain(Array) (Line: 172)
Drupal\Core\Render\Renderer->renderPlaceholder('callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder&args%5B0%5D=postongroupblock&args%5B1%5D=default&args%5B2%5D&token=8ZSByMIrBTb3TyShsmie_pkvhoMwGaxi1gERGHbmvSU', Array) (Line: 693)
Drupal\big_pipe\Render\BigPipe->renderPlaceholder('callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder&args%5B0%5D=postongroupblock&args%5B1%5D=default&args%5B2%5D&token=8ZSByMIrBTb3TyShsmie_pkvhoMwGaxi1gERGHbmvSU', Array) (Line: 547)
Drupal\big_pipe\Render\BigPipe->sendPlaceholders(Array, Array, Object) (Line: 305)
Drupal\big_pipe\Render\BigPipe->sendContent(Object) (Line: 112)
Drupal\big_pipe\Render\BigPipeResponse->sendContent() (Line: 381)
Symfony\Component\HttpFoundation\Response->send() (Line: 20)

Solution

"Dropdown" render element should not set non-existent option as "active"

Issue tracker

Theme issue tracker

n/a

How to test

  • Login as admin
  • Make steps described on "Problem" section

Definition of done

Before merge

  • Code/peer review is completed
  • All commit messages are clear and clean. If applicable a rebase was performed
  • All automated tests are green
  • Functional/manual tests of the acceptance criteria are approved
  • All acceptance criteria were met
  • New features or changes to existing features are covered by tests, either unit (preferably) or behat
  • Update path is tested. New hook_updates should respect update order, right naming convention and consider hook_post_update code
  • Module can be safely uninstalled. Update/implement hook_uninstall and make sure that removed configuration or dependencies are removed/uninstalled
  • This pull request has all required labels (team/type/priority)
  • This pull request has a milestone
  • This pull request has an assignee (if applicable)
  • Any front end changes are tested on all major browsers
  • New UI elements, or changes on UI elements are approved by the design team
  • New features, or feature changes are approved by the product owner

After merge

  • Code is tested on all branches that it has been cherry-picked
  • Update hook number might need adjustment, make sure they have the correct order
  • The Drupal.org ticket(s) are updated according to this pull request status

Screenshots

n/a

Release notes

"Dropdown" render element doesn't set non-existent option as "active"

Change Record

n/a

Translations

n/a

@nechai nechai added type: bug Fixes a bug in Open Social team: enterprise This PR originates from the ECI team status: needs review This pull request is waiting for a requested review prio: medium labels Feb 8, 2023
@nechai nechai added this to the 11.7.2 milestone Feb 8, 2023
@nechai nechai self-assigned this Feb 8, 2023
@mergeable
Copy link

mergeable bot commented Feb 8, 2023

Thanks for contributing towards Open Social! A maintainer from the @goalgorilla/maintainers group might not review all changes from all teams/contributors. Please don't be discouraged if it takes a while. In the meantime, we have some automated checks running and it might be that you will see our comments with some tips or requests to speed up the review process. 😊

Copy link
Contributor

@ribel ribel left a comment

Choose a reason for hiding this comment

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

I've tested changes on the project where we had fatal error on Group Stream and it fix the issue.

@ribel ribel modified the milestones: 11.7.2, 11.6.6 Feb 10, 2023
@tbsiqueira tbsiqueira modified the milestones: 11.6.6, 11.6.7 Feb 15, 2023
@nkoporec nkoporec merged commit 32808b4 into main Feb 21, 2023
@nkoporec nkoporec deleted the issue/3340217-fatal-error-on-group-stream branch February 21, 2023 12:03
@nkoporec
Copy link
Contributor

🍒 picked to 11.6.x, 11.7.x,11.8.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: high status: needs review This pull request is waiting for a requested review team: enterprise This PR originates from the ECI team type: bug Fixes a bug in Open Social
4 participants