Feature pressynced 2954 add email template and email layout interception points#1739
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| var cacheKey = ( $helpers.isTrue( arguments.useDefaultContent ?: "" ) ? "default" : "saved" ) & "rawhtml" & arguments.template; | ||
| $announceInterception( "prePrepareEmailHtmlContent", arguments ); | ||
|
|
||
| var cacheKey = arguments.cacheSuffix ?: ( $helpers.isTrue( arguments.useDefaultContent ?: "" ) ? "default" : "saved" ) & "rawhtml" & arguments.template; |
There was a problem hiding this comment.
Empty cache key causes all emails to share cache
High Severity
The Elvis operator (?:) only checks for null, not empty strings. Since cacheSuffix defaults to "" (line 1620), the expression arguments.cacheSuffix ?: (...) evaluates to "" instead of the fallback cache key calculation. This causes all email templates without an explicit cacheSuffix to share the same empty string cache key, resulting in the first rendered email being returned for all subsequent emails. The original logic constructed unique keys per template, but this change breaks that behavior.


Note
Medium Risk
Low-touch changes but they alter email rendering/config return values via interceptor mutation and adjust cache key behavior, which could affect output consistency across templates/layouts.
Overview
Adds two new extension hooks to the email system by registering
prePrepareEmailHtmlContentandpostGetLayoutConfigas custom interception points.EmailTemplateService._prepareHtml()now announcesprePrepareEmailHtmlContentbefore caching/rendering, andEmailLayoutService.getLayoutConfig()now announcespostGetLayoutConfigand returns the potentially mutatedconfigfrom interceptors (instead of the locally built struct).Written by Cursor Bugbot for commit 126855a. This will update automatically on new commits. Configure here.