PRESSYNCED-3009 Fix email preview showing wrong site template branding - #1734
Conversation
Include siteId in email template cache key to ensure templates are cached per site and prevent cross-site template contamination.
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; | ||
| var siteId = $getRequestContext().getSiteId() ?: ""; | ||
| var cacheKey = siteId & ( $helpers.isTrue( arguments.useDefaultContent ?: "" ) ? "default" : "saved" ) & "rawhtml" & arguments.template; |
There was a problem hiding this comment.
Cache invalidation key mismatch after siteId prefix addition
Medium Severity
The cache key in _prepareHtml now includes a siteId prefix (e.g., {siteId}savedrawhtml{template}), but the cache invalidation in saveTemplate at line 391 still uses the old key format without the prefix (savedrawhtml{id}). This means _getTemplateCache().clear() will attempt to clear a non-existent key, leaving stale cached templates that won't be cleared when templates are updated.
Include siteId in email template cache key to ensure templates are cached per site and prevent cross-site template contamination.
Note
Ensures email previews/rendered HTML use the correct site-specific branding by separating cache entries per site.
EmailTemplateService.cfc_prepareHtmlto prefix cache key with$getRequestContext().getSiteId()siteId + (default|saved) + rawhtml + template, preventing cross-site template contaminationWritten by Cursor Bugbot for commit 9b7c473. This will update automatically on new commits. Configure here.