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 #3408511 by nkoporec: Replace renderRoot() with renderPlain() when trying to render a notifiication in an email #3645

Conversation

nkoporec
Copy link
Contributor

Problem

The renderRoot() should be used as a response to a controller. If we use the renderRoot or render() methods incorrectly it can produce warnings such as:

LogicException: Render context is empty, because render() was called outside of a renderRoot()
We are catching a lot of this kind of logs warnings and its related to when cron processes a queue job.

Solution

Replace renderRoot with renderPlain

Issue tracker

https://www.drupal.org/project/social/issues/3408511

Theme issue tracker

[Required if applicable] Paste a link to the drupal.org theme issue queue item, either from socialbase or socialblue. If any other issue trackers were used, include links to those too.

How to test

It's hard to reproduce this one, but you can try by creating a lot of notifications for a certain user that has the frequency set to 'Immediate', then running cron multiple times to process these jobs... the warning should appear in the watchdog.

Also we need to make sure that the rendering of email notification is the same as before the change.

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

Release notes

Fixed a warning about invalid render state when rendering the email notifications.

Change Record

Translations

@nkoporec nkoporec added type: bug Fixes a bug in Open Social status: needs review This pull request is waiting for a requested review prio: medium team: guardians labels Dec 13, 2023
@nkoporec nkoporec added this to the 12.0.1 milestone Dec 13, 2023
Copy link

mergeable bot commented Dec 13, 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. 😊

@vcsvinicius vcsvinicius self-requested a review December 13, 2023 17:40
Copy link
Contributor

@vcsvinicius vcsvinicius left a comment

Choose a reason for hiding this comment

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

I approved the PR

@ronaldtebrake ronaldtebrake force-pushed the bug/issue-3408511/replace-render-root-with-render-plain-when-rendering-email branch from 0b40482 to bafc894 Compare December 21, 2023 15:25
@BiaInacio
Copy link
Contributor

BiaInacio commented Dec 21, 2023

Notification test is done, but I was not able to test the emails
sent 30+ notification and it is working fine.
image
image

@ronaldtebrake ronaldtebrake merged commit 1a13228 into main Dec 22, 2023
186 checks passed
@ronaldtebrake ronaldtebrake deleted the bug/issue-3408511/replace-render-root-with-render-plain-when-rendering-email branch December 22, 2023 07:06
@ronaldtebrake ronaldtebrake added backport: verified This pull request has been back ported to an older minor version and removed status: needs review This pull request is waiting for a requested review labels Dec 22, 2023
@ronaldtebrake
Copy link
Contributor

Cherry picked to 12.1.x and 12.0.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport: verified This pull request has been back ported to an older minor version prio: medium team: guardians type: bug Fixes a bug in Open Social
Development

Successfully merging this pull request may close these issues.

4 participants