- First commit to issue fork.
- last update
over 1 year ago 7 pass - @bohart opened merge request.
- Status changed to Needs review
over 1 year ago 5:26pm 10 October 2023 - πΊπ¦Ukraine bohart Lutsk, Ukraine
We need this functionality for the proper work of https://www.drupal.org/project/reroute_email β
As cc/bcc/reply-to addresses can be erased for "the rerouting emails".
So, a new merge request with appropriate changes has been created:
https://git.drupalcode.org/project/symfony_mailer/-/merge_requests/66
Looking forward to this change being reviewed and merged/committed to the module.Thanks!
- Status changed to Needs work
over 1 year ago 7:53pm 10 October 2023 - last update
over 1 year ago 7 pass - Status changed to Needs review
over 1 year ago 8:28pm 10 October 2023 - πΊπ¦Ukraine bohart Lutsk, Ukraine
Round #2 of Needs work Β» Needs Review π
@AdamPS, thanks for your prompt reaction and all your contributions to the community!
- last update
over 1 year ago 7 pass - Status changed to Needs work
over 1 year ago 4:04pm 11 October 2023 - π¬π§United Kingdom adamps
Great thanks, just one last change please
Plus, please can we have a test? I am accepting bug fixes without a test, and asking that new features include a test.
In SymfonyMailerKernelTest can add a new function testAddress(). Call a few of the BaseEmailInterface address functions with set and get. If possible use a single address, and multiple. Use the different options in Address::create.
- last update
over 1 year ago 8 fail - last update
over 1 year ago 24 pass, 1 fail - last update
over 1 year ago 26 pass - Status changed to Needs review
over 1 year ago 9:13pm 11 October 2023 - πΊπ¦Ukraine bohart Lutsk, Ukraine
Here is a short summary of the updated Merge request:
1) We need a way to set/get all headers (cc/bcc/reply-to) and it will be a bad way to duplicate the logic in every setter/getter.
So an addition methodgetAddress
has been added to the interface and its implementation.
The input params forsetAddress
andgetAddress
have been aligned.2) The same with tests. Added
MailerTestTrait::assertAddress
method.3) Added LegacyTestEmailForm::ADDRESS_TO / LegacyTestEmailForm::ADDRESS_CC / LegacyTestEmailForm::ADDRESS_BCC constants.
To avoid hard-coding of the same addresses across the test module and the tests itself.4) Added testEmailAddresses test to actually test all possible combinations of:
- different headers (cc, bcc, reply-to);
- different addresses for those headers (string, '', Address object without display name, Address object with display name, an array of all those options);
- it also tests both sets and erases (NULL value) for all of these headers.It becomes to be a quite big Merge request, but this is the only way to put it all together.
ps. The first commit failed due to PHP 7.4 limitation (mixed typehint has been added in PHP 8). This was fixed and all tests are green now.
Looking forward!
- Status changed to Needs work
over 1 year ago 9:49am 12 October 2023 - π¬π§United Kingdom adamps
Great many thanks for your enthusiasm to contribute to this module. The new changes are basically good, but please avoid unnecessary changes.
- last update
over 1 year ago 26 pass - Status changed to Needs review
over 1 year ago 1:52pm 12 October 2023 - πΊπ¦Ukraine bohart Lutsk, Ukraine
1) Here is a comment about mb_strtolower:
https://git.drupalcode.org/project/symfony_mailer/-/merge_requests/66/di...2) Here is a comment about moving re-usable variables into constants:
https://git.drupalcode.org/project/symfony_mailer/-/merge_requests/66/di...3) Param $header renamed to $name in setAddress/getAddress methods and everywhere for consistency with other code.
assertCc / assertTo methods are back as requested. Added corresponding assertBcc / assertReplyTo methods. Commit:
https://git.drupalcode.org/project/symfony_mailer/-/merge_requests/66/di...All tests are passed after the changes.
Hopefully, we're finally ready to merge this request and proceed with other issues on the queue.
Thanks!
- Status changed to Needs work
over 1 year ago 8:52am 13 October 2023 - π¬π§United Kingdom adamps
Thank you for your continued work on this issue.
1) I can't find your comment about mb_strtolower().
2)
Those addresses are used in different places (code, tests, etc).
We should have constants for them to avoid changing the address in some places and possibly forgetting (don't find) some others.
My bet is this class is good to store them. If some other better class/interface in the module to do so, please let me know.Yes I agree that constants are good. The previous developer didn't use them, and I didn't insist because it wasn't that important. Why would we ever change the address? In fact you are the only one trying to change the addressπ, which means that if any other developer had used LegacyTestEmailForm in their own tests then you would break their code.
This is an issue about removal of addresses. It doesn't really work well if each person who makes a patch tries to rewrite the code that the previous person wrote because they don't like the way it was done before. There have been a number of complaints for sites using this module about their sites breaking with new versions. My job as maintainer is to avoid unnecessary changes. Therefore please can you remove all the changes that are not related to this fix? For example TestEmailTest.php and testInlineCss().
- last update
over 1 year ago 24 pass, 2 fail - last update
over 1 year ago 24 pass, 2 fail - last update
over 1 year ago 26 pass - Status changed to Needs review
over 1 year ago 12:10pm 14 October 2023 - πΊπ¦Ukraine bohart Lutsk, Ukraine
Hi Adam,
Thanks for your passion while maintaining this module!
Hopefully, my comments are reading in a good manner. Cause I have a plan to propose some more MR in some other tasks here on drupal-org issue queue :) I maintain a few modules related to mail delivery ( reroute_email β , mailgun β , mailjet β , unione β ), and there is a plan on my plate to release D10 versions for all of them (compatible with Drupal Symfony Mailer).1) Regarding mb_strtolower, here is another link to the comment (which will not be outdated again):
https://www.drupal.org/project/symfony_mailer/issues/3285188#mr66-note21... β¨ Allow removal of to/cc/bcc/reply-to addresses (after they are added to an email) Needs work2) Regarding hard-coded test addresses,
a) While maintaining other modules related to mail delivery, I have already faced a few issues when different modules use the same simple test addresses (like to@example.com, cc@example.com, bcc@example.com, etc). It's always better to use either module-specific addresses or $this->randomMachineName() to generate unique addresses on every test run).
b) We should not hard-coded simple addresses like 'test@example.com' in different places (test module form class, main module test classes, etc). As we can misunderstand which address is related to which functionality and tests (if we have exactly the same hard-coded addresses). Either variables or constants will greatly help understand the code for all further contributors (which address comes from and where they are used).
c) Introducing a new constant will not cause any incompatibility issues.3) All changes from `tests/src/Functional/TestEmailTest.php` and `tests/src/Functional/OverrideTest.php` have been removed according to these comments:
β https://www.drupal.org/project/symfony_mailer/issues/3285188#mr66-note21... β¨ Allow removal of to/cc/bcc/reply-to addresses (after they are added to an email) Needs work
β https://www.drupal.org/project/symfony_mailer/issues/3285188#mr66-note21... β¨ Allow removal of to/cc/bcc/reply-to addresses (after they are added to an email) Needs work4) `empty($addresses)` is replaced with `is_null($addresses)` to align with the interface's method documentation according to this comment:
β https://www.drupal.org/project/symfony_mailer/issues/3285188#mr66-note21... β¨ Allow removal of to/cc/bcc/reply-to addresses (after they are added to an email) Needs work
This one was a really good catch.Thanks!
- Status changed to Needs work
over 1 year ago 1:27pm 14 October 2023 - π¬π§United Kingdom adamps
OK, thanks again, your new code is a good balance of stability and improving quality.
1 )I still don't see the comment about strtolowerπ. If it's wrong then of course I'm willing to fix it. But in that case we should fix it in all places in this module, and perhaps it would be better on a different issue.
2)
$this->assertContains($name, ['to', 'cc', 'bcc', 'reply-to']);
Please can we remove this line? (I believe I made a comment before but it got lost)And instead put the assert in getAddress() same as setAddress()
$name = strtolower($name); assert(isset($this->addresses[$name]));
- last update
over 1 year ago 26 pass - Status changed to Needs review
over 1 year ago 4:48pm 14 October 2023 - πΊπ¦Ukraine bohart Lutsk, Ukraine
Here is a copy-paste of the comment about `strtolower`:
All Drupal core and Drupal contrib modules are updating to use mb_strtolower instead of strtolower. Since Drupal 8.6.0 it's recommended to use mb_* functions (instead of drupal_strtolower, or Unicode::strtolower, or strtolower).
Change record: https://www.drupal.org/node/2850048 β
Core recommendation: Use mb_strtolower() instead._____
MR updated according to all requested changes in the last comment:
1) Replaced all usages of mb_strtolower to `strtolower` (as it is currently on 1.x branch).
We currently have four usages of `strtolower` function across the module.
I'll create another drupal-org issue to proceed on this.2) Removed this line.
Hopefully, we're ready to merge this!
As it's required for the proper work of reroute_email module. - Status changed to Needs work
over 1 year ago 11:06am 15 October 2023 - π¬π§United Kingdom adamps
Great thanks. Sorry I know you want to get this in, and we're really close now.
2) had two parts: remove a line (in the tests), then add two lines (in the live code). Any chance you could make this one final change please then I will commit.
- πΊπ¦Ukraine bohart Lutsk, Ukraine
I'm afraid I can't understand this. Could you please clarify on:
remove a line (in the tests), then add two lines (in the live code).
Do you mean to create some new tests that remove lines from the email or does some code need to be changed?
But I can't find any lines in the code to represent this need.Thanks!
- π¬π§United Kingdom adamps
Please could you add these two lines in BaseEmailTrait::getAddress() the same as setAddress()
$name = strtolower($name); assert(isset($this->addresses[$name]));
This will catch getAddress with a wrong name
- last update
over 1 year ago 26 pass - Status changed to Needs review
over 1 year ago 6:39pm 15 October 2023 - πΊπ¦Ukraine bohart Lutsk, Ukraine
- last update
over 1 year ago 26 pass - Status changed to Fixed
over 1 year ago 1:04pm 17 October 2023 -
AdamPS β
committed 3ca8bc3c on 1.x authored by
bohart β
Issue #3285188 by bohart, freelock, AdamPS: Allow removal of to/cc/bcc/...
-
AdamPS β
committed 3ca8bc3c on 1.x authored by
bohart β
Automatically closed - issue fixed for 2 weeks with no activity.