Feature PR-6.2-dev Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
30 Apr 2026

Pull Request resolves # .

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Deprecates the static functions in the MailTemplate class as they are not used in core at all. Additionally it injects a database object to prevent depreacted Factory::getDbo() calls.

Testing Instructions 1

  • Log in on the back end
  • Got to the global configuration server tab
  • Send a test mail

Actual result BEFORE applying this Pull Request

Mail is sent.

Expected result AFTER applying this Pull Request

Mail is sent.

Testing Instructions 2

  • Add the code \Joomla\CMS\Mail\MailTemplate::createTemplate('com_mails.prtest','test subject','test body',[]); to the file /administrator/components/com_mails/src/View/Templates/HtmlView.php on line 97.
  • Open the back end Mail Templates list on /administrator/index.php?option=com_mails&view=templates
  • Search for test
  • Check the mail templates list that it has one entry
  • Change the line 97 to \Joomla\CMS\Mail\MailTemplate::createTemplate('com_mails.prtest', 'test subject edited', 'test body edited', []);-
  • Reload the mail templates list
  • Click on the prtest entry in the list
  • Check the form that it displays as subject "test subject edited" and as body "test body edited"
  • Change the line 97 to \Joomla\CMS\Mail\MailTemplate::deleteTemplate('com_mails.prtest');
  • Hit the close button in the form
  • No Mail template is shown in the list

Actual result BEFORE applying this Pull Request

All the checks above are successful.

Expected result AFTER applying this Pull Request

All the checks above are successful.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org: #47717

  • No documentation changes for manual.joomla.org needed

avatar laoneo laoneo - open - 30 Apr 2026
avatar laoneo laoneo - change - 30 Apr 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Apr 2026
Category Administration com_config Libraries
avatar laoneo laoneo - change - 30 Apr 2026
The description was changed
avatar laoneo laoneo - edited - 30 Apr 2026
avatar Hackwar
Hackwar - comment - 6 May 2026

I'm having issues commenting in the code directly, so here the comments not in line with the actual code:

I have problems with calling the model of com_mails, since it breaks the layers of a proper system. A library should never call code from a higher layer and only go to lower layers. So we shouldn't really call component code in the libraries, similar to that we can't call CMS code in the Joomla framework.

Also, when you deprecate something, please directly use the new code in the method and don't leave two separate implementations for the same feature in the codebase.

avatar laoneo laoneo - change - 13 May 2026
Labels Added: PR-6.2-dev
f970c41 13 May 2026 avatar laoneo space
8e698af 13 May 2026 avatar laoneo stan
avatar laoneo laoneo - change - 13 May 2026
Labels Added: Feature
ade26c2 13 May 2026 avatar laoneo cs
73513a3 13 May 2026 avatar laoneo cs
avatar laoneo laoneo - change - 16 May 2026
The description was changed
avatar laoneo laoneo - edited - 16 May 2026
avatar laoneo laoneo - change - 16 May 2026
The description was changed
avatar laoneo laoneo - edited - 16 May 2026
avatar laoneo laoneo - change - 18 May 2026
Title
[6.2] Deprecate static functions in MailTemplate and inject app
[6.2] Deprecate static functions in MailTemplate and inject db
avatar laoneo laoneo - edited - 18 May 2026
avatar laoneo
laoneo - comment - 2 Jun 2026

Using now the replacement functions in the component and reverted the none deprecated code to not use the component.

Add a Comment

Login with GitHub to post a comment