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

[5.2] Fix extension query in mailtemplates #44769

Open
wants to merge 1 commit into
base: 5.2-dev
Choose a base branch
from

Conversation

SniperSister
Copy link
Contributor

@SniperSister SniperSister commented Jan 22, 2025

Summary of Changes

The mail templates list view shows a list of all available templates from the #__mail_templates table. While doing so, it checks if the associated extension is enabled.

However, it uses the value of the "name" column in the #__extensions table for the subquery (which might hold a human-readable name and not the technical "element" name), causing templates to be not listed if the name and element of the associated extension do not align.

Testing Instructions

  • Temporarly change the value of the "name" column of com_contact in #__extensions from com_contact to Contact
  • List the available mail templates

Actual result BEFORE applying this Pull Request

  • com_contact templates missing

Expected result AFTER applying this Pull Request

  • com_contact templates listed

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@richard67
Copy link
Member

Hmm, when filling the mail templates table for new installations it seems we are using the extensions name and not the element:

https://github.com/joomla/joomla-cms/blob/5.2-dev/installation/sql/mysql/supports.sql#L410-L440

So I'm not really sure if this PR is right or if it needs changes at additional places.

Pity that the extension column of the #__mail_templates is a string with a name or whatever else and not an integer with the extension ID (which would allow a foreign key whenever we will support that).

@SniperSister
Copy link
Contributor Author

it seems we are using the extensions name and not the element:

Those are the elements? See the #__extensions table

@richard67
Copy link
Member

it seems we are using the extensions name and not the element:

Those are the elements? See the #__extensions table

Yes, because for components, modules and templates the name and the element columns have the same value in our installation SQL. For other modules they differ.

Are the extensions which can be assigned to mail templates restricted to certain types, e.g. components?

If so, it could make sense to add a restriction for that (WHERE type IN ...) to the where clause of the subquery which is modified by this PR.

@SniperSister
Copy link
Contributor Author

Are the extensions which can be assigned to mail templates restricted to certain types, e.g. components?

Nope, basically anything works.

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

Successfully merging this pull request may close these issues.

3 participants