Skip to content

PRESSYNCED-3009 Fix email preview showing wrong site template branding - #1734

Open
AdrianTze wants to merge 2 commits into
pixl8:stablefrom
AdrianTze:PRESSYNCED-3009_email_preview_shows_wrong_site_template_branding
Open

PRESSYNCED-3009 Fix email preview showing wrong site template branding#1734
AdrianTze wants to merge 2 commits into
pixl8:stablefrom
AdrianTze:PRESSYNCED-3009_email_preview_shows_wrong_site_template_branding

Conversation

@AdrianTze

@AdrianTze AdrianTze commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

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.

  • Updates EmailTemplateService.cfc _prepareHtml to prefix cache key with $getRequestContext().getSiteId()
  • Cache key now: siteId + (default|saved) + rawhtml + template, preventing cross-site template contamination

Written by Cursor Bugbot for commit 9b7c473. This will update automatically on new commits. Configure here.

Include siteId in email template cache key to ensure templates are
cached per site and prevent cross-site template contamination.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant