Tenant email cta theme fix #2677
Ticket(s) / Related Merge Requests
Summary of Changes
Second attempt at fix for the cta buttons after it was reverted after regression.
Now, when EmailStylesV2 is unserialized, we make sure that configs are initialized before applying theme overrides.
This was the error from the regression:
[04-Mar-2024 10:35:33 UTC] Minds.CRITICAL: Error: Typed property Minds\Core\Email\V2\Common\EmailStylesV2::$config must not be accessed before initialization in /var/www/Minds/engine/Core/Email/V2/Common/EmailStylesV2.php:189 Stack trace:
#0 /var/www/Minds/engine/Core/Email/V2/Common/EmailStylesV2.php(230): Minds\Core\Email\V2\Common\EmailStylesV2->getThemeOverrides()
#1 /var/www/Minds/engine/Core/Email/V2/Common/EmailStylesV2.php(248): Minds\Core\Email\V2\Common\EmailStylesV2->getMergedStyleDefinitions()
#2 /var/www/Minds/engine/Core/Email/V2/Campaigns/Recurring/ForgotPassword/template.v2.tpl(2): Minds\Core\Email\V2\Common\EmailStylesV2->getStyles(Array)
#3 /var/www/Minds/engine/Core/Email/V2/Common/Template.php(217): include('/var/www/Minds/...')
#4 /var/www/Minds/engine/Core/Email/V2/Common/Template.php(191): Minds\Core\Email\V2\Common\Template->compile('/var/www/Minds/...')
#5 /var/www/Minds/engine/Core/Email/V2/Common/Message.php(122): Minds\Core\Email\V2\Common\Template->render()
#6 /var/www/Minds/engine/Core/Email/Mailer.php(102): Minds\Core\Email\V2\Common\Message->buildHtml()
#7 /var/www/Minds/engine/Core/Queue/Runners/PriorityEmail.php(28): Minds\Core\Email\Mailer->send(Object(Minds\Core\Email\V2\Common\Message))
#8 /var/www/Minds/engine/Core/Queue/LegacyClient.php(67): Minds\Core\Queue\Runners\PriorityEmail->Minds\Core\Queue\Runners\{closure}(Array)
#9 [internal function]: Minds\Core\Queue\LegacyClient->Minds\Core\Queue\{closure}(Object(Minds\Core\Queue\Message), Object(Pulsar\Message))
#10 /var/www/Minds/engine/Core/Queue/LegacyQueueTopic.php(131): call_user_func(Object(Closure), Object(Minds\Core\Queue\Message), Object(Pulsar\Message))
#11 /var/www/Minds/engine/Core/Queue/LegacyClient.php(79): Minds\Core\Queue\LegacyQueueTopic->consume('PriorityEmail', Object(Closure), 'PriorityEmail')
#12 /var/www/Minds/engine/Core/Queue/Runners/PriorityEmail.php(31): Minds\Core\Queue\LegacyClient->receive(Object(Closure))
#13 /var/www/Minds/engine/Controllers/Cli/QueueRunner.php(32): Minds\Core\Queue\Runners\PriorityEmail->run() #14 /var/www/Minds/engine/cli.php(94): Minds\Controllers\Cli\QueueRunner->run() #15 {main} {"exception":"[object] (Error(code: 0): Typed property Minds\\Core\\Email\\V2\\Common\\EmailStylesV2::$config must not be accessed before initialization at /var/www/Minds/engine/Core/Email/V2/Common/EmailStylesV2.php:189)"}
Testing Considerations
Not really possible
Sandbox: https://olivia.oke.minds.io/
Deployment Considerations
Regression Scope
PriorityEmail runner
Platform Affected (web, mobile, etc)
Both
Developer Testing Completed
Recreated the bug, then checked that the bug was fixed.
This is how:
- On master, with the PriorityEmail runner off, request a password reset email. The email is not sent.
- Change to the version of this branch that caused the regression, then turn on the runner. See that the runner breaks when it tries to send the email.
- Request another password reset email, again with the runner off. The email is not sent.
- Apply with the latest changes from this MR, turn the runner on, and request another password reset email.
- See that both emails are sent with no errors.
Screenshots / Screen Recording
n/a
Does this impact
-
Localization -
Dark/light mode -
Guest mode
Definition of Done Checklist
-
The Acceptance Criteria has been met -
Code is tested: Testing includes unit/spec, E2E/automated and manual testing -
Merge requests description has been filled out
Edited by Olivia Madrid