[6.2] MailTemplate should work with interface#47677
[6.2] MailTemplate should work with interface#47677laoneo wants to merge 4 commits intojoomla:6.2-devfrom
Conversation
|
I have tested this item ✅ successfully on a59506a This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47677. |
|
I have tested this item ✅ successfully on a59506a This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47677. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47677. |
|
I would question about the valid of this PR. Maybe someone with stronger OPP background should look at this more carefully
|
|
All it does is to support the interface and doesn't restrict to the Mail class as we should work with interfaces. If you need these parameters like isHTML, then extend from Mail class. But there is no point to not work with interfaces. If I have a plugin which redirects everything to a custom Mailer service or whatever, there is no need to configure SMTP, etc. This brings a lot of flexibility while not loosing any settings from before. |
|
I think it just a fake support to interface because if you pass any implement of the interface which is not a Mail instance, you will loose the features of MailTemplate which I mentioned earlier. Plus the support interface while having to check for concrete implement seems not right to me. That's what I see from looking at the change in this PR. I will leave it to other maintainers and release managers to look at it further and make final decision. |
|
Due all respect, but your comment doesn't make sense at all. This is how support for the interface should be implemented in a backwards compatible way. Mailer instances which come from the factory doesn't have to be always a Mail class. If a plugin would implement it's own mailer (which is not a Mail class) and set it in the global container, then this code would badly break. When this gets merged, then we can convert the rest of the code away from Factory::getMailer, otherwise we will have to life forever with it. |
|
Sorry, I do not see the point of supporting interface if it causes loosing features of MailTemplate. I have expressed my concerns in my earlier comments, it's normal that you do not agree or I am wrong. Let's wait for feedbacks from others. |
|
No problem, don't expect it either. |
|
Back to pending. See previous comment. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47677. |
|
Please test attachments too. |
|
I'v updated the testing instructions with HTML and attachment test. |
Summary of Changes
The
MailTemplateclass should work with an injectedMailerInterfaceand not concrete implementation to be more flexible. Additionally this pr deprecates the optional parameter to be able to remove the deprecated Factory usage.Testing Instructions 1
Actual result BEFORE applying this Pull Request
Mail is sent.
Expected result AFTER applying this Pull Request
Mail is sent.
Testing Instructions 2
Actual result BEFORE applying this Pull Request
Mail is sent with attachment in HTML format.
Expected result AFTER applying this Pull Request
Mail is sent with attachment in HTML format.
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: MailTemplate should work with interface Manual#620
No documentation changes for manual.joomla.org needed