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

Language Override System: Core email template structure lost when viewing/editing override #44396

Open
Pinkeltje opened this issue Nov 2, 2024 · 2 comments

Comments

@Pinkeltje
Copy link

Description

When viewing or editing the COM_ACTIONLOGS_EMAIL_HTMLBODY language constant in the Language Override component, the table structure is completely stripped, leaving only newlines. This prevents administrators from being able to view or modify the email template structure.

Current Behavior

Original language constant:

COM_ACTIONLOGS_EMAIL_HTMLBODY="<h1>Latest User Actions</h1>\n<h2>This is the latest action performed by a user on your website.</h2>\n<table>\n<thead>\n<th>Action</th>\n<th>Date</th>\n<th>Extension</th>\n<th>Name</th>\n</thead>\n<tbody>\n{MESSAGES}<tr>\n<td>{MESSAGE}</td>\n<td>{DATE}</td>\n<td>{EXTENSION}</td>\n<td>{USERNAME}</td>\n</tr>{/MESSAGES}\n</tbody>\n</table>"

What appears in Language Override editor:

<h1>Latest User Actions</h1>\n<h2>This is the latest action performed by a user on your website.</h2>\n\n\n\n\n\n\n\n\n{MESSAGES}\n\n\n\n\n{/MESSAGES}\n\n

The entire table structure including headers and cells is stripped out, leaving only newlines in their place.

Expected Behavior

The Language Override editor should:

  1. Show the complete language string including the table structure
  2. Allow viewing and editing of the original HTML structure
  3. Preserve the email template layout capabilities

Steps to Reproduce

  1. Go to System → Languages → Overrides
  2. Search for COM_ACTIONLOGS_EMAIL_HTMLBODY
  3. Click to edit the constant
  4. Observe that all table-related HTML is missing, replaced with newlines

Technical Details

  • Joomla Version: 5.0
  • Affected Component: Language Overrides
  • Constant: COM_ACTIONLOGS_EMAIL_HTMLBODY

Impact

  1. Administrators cannot see the original email template structure
  2. Unable to make modifications while preserving the table layout
  3. Breaks the ability to customize action log email notifications
  4. Affects core functionality of the User Actions Log feature

Suggested Solutions

  1. Modify the Language Override system to preserve table structures in email-related constants
  2. Add an exception for email template constants
  3. Add a way to mark certain language strings as containing essential HTML that should not be stripped

Additional Context

This appears to be an overly aggressive HTML stripping in the Language Override system. While security is important, stripping HTML from email templates prevents legitimate customization of system emails.
See: #43503

@Hackwar
Copy link
Member

Hackwar commented Nov 3, 2024

Thank you @Pinkeltje for reporting this. While the language override system might be very agressive here, it is not meant to edit the email templates. We have the mail template system for this and the language keys are basically just a concession to backwards compatibility. A special handling for email template language key constants is not possible, (already simply by the fact that we don't know what language key is a mail template) but we do indeed have to check if stripping the HTML is correct here.

@Pinkeltje
Copy link
Author

Pinkeltje commented Nov 4, 2024

@Hackwar

it is not meant to edit the email templates

As the mailtemplate wasn't working I decided to try with language override. So I really don't know where it goes wrong. But even a simple change in mailtemplate ruins everything.
Original mailtemplate
Image
Small change by changing only second line from <h2> to <p>
Image
Result
Image

Don't know if this info helps, but when I change COM_ACTIONLOGS_EMAIL_HTMLBODY in core language file using <div> in stead of <table> etc, mail is ok-ish (at least all info is preserved), but wrong layout in Outlook.

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

No branches or pull requests

3 participants