The list of recipient emails on admin/structure/contact requires the use of commas to separate them. This results in an error if you try entering them using new lines instead.

Screenshot of current state:

Screenshots of proposed change
change listing to "each on new line"

List with bullets

Small screen (recipients are hidden)

CommentFileSizeAuthor
#86 contact_forms_ux-267492-86.patch10.2 KBAJV009
#84 contact_forms_ux-267492-84.patch10.2 KBAJV009
#82 contact_forms_ux-267492-82.patch10.18 KBAJV009
#81 contact_forms_ux-267492-81.patch10.2 KBAJV009
#79 contact_forms_ux-267492-79.patch10.33 KBAJV009
#76 Screen Shot 2020-09-02 at 1.02.14 pm.png31.71 KBpameeela
#76 Screen Shot 2020-09-02 at 1.02.00 pm.png39.43 KBpameeela
#66 contact_forms_ux-267492-64.patch9.92 KBmadhavvyas
#62 contact_forms_ux-267492-62.patch10.93 KBmadhavvyas
#60 email_valid_not_perfect.png44.71 KBfil00dl
#60 email_edit_OK.png28.09 KBfil00dl
#60 email_edit_not_OK.png29.71 KBfil00dl
#58 interdiff_57-58.txt703 bytesMarcus Maihoff
#58 contact_forms_ux-267492-58.patch10.88 KBMarcus Maihoff
#57 contact_forms_ux-267492-57.patch10.19 KBmadhavvyas
#52 interdiff-267492-35-52.txt2.46 KBid.tarzanych
#52 267492-contact_forms_ux-52.patch10.19 KBid.tarzanych
#46 interdiff-267492-35-46.txt951 bytesid.tarzanych
#46 267492-contact_forms_ux-46.patch10.87 KBid.tarzanych
#44 interdiff-267492-35-44.txt931 bytesid.tarzanych
#44 267492-contact_forms_ux-44.patch10.96 KBid.tarzanych
#38 267492-contact_forms_ux-35.patch10.74 KBMykolaBova
#35 contact_list.png26.03 KBandypost
#35 267492-contact_forms_ux-34.patch11.17 KBandypost
#35 interdiff.txt1.12 KBandypost
#33 267492-contact_forms_ux-33.patch11.24 KBandypost
#29 267492-contact_forms_ux-29.patch11.22 KBandypost
#29 interdiff.txt3.32 KBandypost
#26 267492-contact_forms_ux-26.patch10.06 KBandypost
#26 interdiff.txt1.3 KBandypost
#26 contact_error.png21.97 KBandypost
#24 267492-contact_forms_ux-24.patch9.77 KBandypost
#24 interdiff.txt1.53 KBandypost
#21 interdiff.txt1.39 KBandypost
#21 267492-contact_forms_ux-21.patch8.51 KBandypost
#19 267492-19.patch8.22 KBandypost
#19 interdiff.txt4.77 KBandypost
#18 contact_list_wide.png70.42 KBandypost
#16 contact_list_admin.png34.95 KBandypost
#16 267492-16.patch3.4 KBandypost
#16 interdiff.txt2.01 KBandypost
#15 contact_edit_new.png61.9 KBandypost
#15 267492-15.patch1.4 KBandypost
#14 contact_admin_edit.png22.76 KBandypost
#14 contact_admin.png22.91 KBandypost
#7 267492-7.patch5.39 KBJody Lynn
#4 267492-contact-long-email-list-D7.patch4.58 KBDave Reid
#1 267492-contact-long-email-list-D7.patch768 bytesDave Reid

Issue fork drupal-267492

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Title: long list of recipient emails makes contact admin page unusable » Long lists of recipient emails in admin/build/contact does not wrap
Version: 6.2 » 7.x-dev
Status: Active » Needs review
FileSize
768 bytes

Patch attached for review.

mcrittenden’s picture

Status: Needs review » Needs work

Patch does a good job fixing the issue at admin/build/contact but the list still fails to wrap at admin/build/contact/edit/%n ...we either need to also fix the issue there or change that textarea to a text input (no point in having a textarea when everything's being put on one line).

Dave Reid’s picture

I'm thinking that we should probably do it the Drupal(tm) way and have them list e-mail address, one per line instead of separated by commas with no spaces. That's just silly.

Dave Reid’s picture

Status: Needs work » Needs review
FileSize
4.58 KB

Revised patch that uses newlines instead of commas. Don't have time to test the upgrade path, but will check tomorrow. Peer review welcomed.

Status: Needs review » Needs work

The last submitted patch failed testing.

Dave Reid’s picture

Assigned: Unassigned » Dave Reid
Jody Lynn’s picture

Status: Needs work » Needs review
FileSize
5.39 KB

I rerolled it

mcrittenden’s picture

Does this need to be pushed to 8.x now?

joachim’s picture

Perhaps Dave Reid's patch to do it the Drupal(tm) way has to be pushed to 8, but we still need to fix the output bug for 7. Ironic that the Drupal way is not the Drupal way ;)

joachim’s picture

Version: 7.x-dev » 8.x-dev

Changing version.

kscheirer’s picture

#7: 267492-7.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 267492-7.patch, failed testing.

mgifford’s picture

Assigned: Dave Reid » Unassigned
Issue summary: View changes
andypost’s picture

Issue summary: View changes
Issue tags: +Needs issue summary update, +Usability, +Needs usability review
FileSize
22.91 KB
22.76 KB

added screenshots

andypost’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
1.4 KB
61.9 KB

no update of config needed, so just testing coverage

Patch makes edit form better

andypost’s picture

And iteration on list builder, each recipient is valid email so safe markup is unneded

The last submitted patch, 15: 267492-15.patch, failed testing.

andypost’s picture

Issue summary: View changes
FileSize
70.42 KB

And added to hide column on small screens

andypost’s picture

FileSize
4.77 KB
8.22 KB

Fix tests

The last submitted patch, 16: 267492-16.patch, failed testing.

andypost’s picture

Improved list builder to not render list if there's only one recepient and display "No recipients" for empty list

The last submitted patch, 19: 267492-19.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 21: 267492-contact_forms_ux-21.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
1.53 KB
9.77 KB

Fix tests

mgifford’s picture

Issue summary: View changes

This seems to work now as described with the line breaks.

I wonder if it would be useful to filter for comma's - given that we used to be able to use them ",". They could be just stripped out, right?

More importantly, it would be useful to strip out blank lines (especially the final one). Kinda annoying to be tripped up because of a blank line return.

Thanks for pushing this ahead @andypost - I modified the summary a bit to reflect the new URL.

andypost’s picture

Issue summary: View changes
FileSize
21.97 KB
1.3 KB
10.06 KB

@mgifford there's no way to have blank lines, do you mean that?

looks that needs test or separate issue because currently you can't enter my@gmail.com, , my@mail.ru

larowlan’s picture

Issue tags: +Needs upgrade path

Patch looks good, but we need an update hook to migrate the config from , separated to "\n"

larowlan’s picture

Issue tags: -Needs upgrade path

Actually @andypost pointed out they're stored as an array, so no need for the update hook - nice

andypost’s picture

FileSize
3.32 KB
11.22 KB

Yep, no upgrade path needed.

Looks having empty lines needs more tests, to make sure that mail send allows empty recipients (, , ,)

mgifford’s picture

@andypost - I was more worried about having an empty line break at the end of a list of emails. I tested drupal without the patch and my@gmail.com, my@mail.ru, fails too, which is the same problem.

I can set up a different issue though to deal with this as well as my@gmail.com \n my@mail.ru \n & my@gmail.com \n \n my@mail.ru

mgifford’s picture

Title: Long lists of recipient emails in admin/build/contact does not wrap » Long lists of recipient emails in admin/structure/contact does not wrap
andypost’s picture

andypost’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
11.24 KB

re-roll + render one item with $row['recipients']['data']['#markup'] = $recipients[0];

andypost’s picture

maybe better to sort emails before display?

andypost’s picture

Clean-up, now listing displayed fine so let's keep the comma list

Status: Needs review » Needs work

The last submitted patch, 35: 267492-contact_forms_ux-34.patch, failed testing.

MykolaBova’s picture

Status: Needs work » Needs review
Issue tags: +dcuacs2015
FileSize
10.74 KB

re-roll

MykolaBova’s picture

Assigned: Unassigned » MykolaBova
andypost’s picture

Assigned: MykolaBova » Unassigned

Still needs usability review

m1r1k’s picture

Please, do not save empty "recipients" lines into storage only to provide way to group them.

andypost’s picture

Status: Needs review » Needs work

for #41

Bojhan’s picture

Issue tags: -Needs usability review

Looks good to me, what needs review here?

id.tarzanych’s picture

id.tarzanych’s picture

Status: Needs work » Needs review
id.tarzanych’s picture

The last submitted patch, 44: 267492-contact_forms_ux-44.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 46: 267492-contact_forms_ux-46.patch, failed testing.

The last submitted patch, 44: 267492-contact_forms_ux-44.patch, failed testing.

andypost’s picture

That will fail
Value array ( 0 => 'simpletest&@example.com', 2 => 'simpletest2@example.com', ) is equal to value array ( 0 => 'simpletest&@example.com', 1 => '', 2 => 'simpletest2@example.com', ).
because there's a test for empty lines

Also you have to set the value back to form state to allow other validation to work with cleaned values, also that's require a short comment

+++ b/core/modules/contact/src/MailHandler.php
@@ -102,7 +102,7 @@ public function sendMailMessages(MessageInterface $message, AccountInterface $se
-      $to = implode(', ', $contact_form->getRecipients());
+      $to = implode(', ', array_filter($contact_form->getRecipients()));

array_filter() is not needed if validation clean-ups the empty lines

The last submitted patch, 46: 267492-contact_forms_ux-46.patch, failed testing.

id.tarzanych’s picture

Fixed test cases, removed extra array_filter

id.tarzanych’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 52: 267492-contact_forms_ux-52.patch, failed testing.

madhavvyas’s picture

Issue tags: +Needs reroll
madhavvyas’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
10.19 KB

Patch re rolled #52

Marcus Maihoff’s picture

This patch should fix the inline list-items to a block element.

Status: Needs review » Needs work

The last submitted patch, 58: contact_forms_ux-267492-58.patch, failed testing.

fil00dl’s picture

Issue summary: View changes
FileSize
29.71 KB
28.09 KB
44.71 KB

It's not possible to validate all emails on the same line, separate by spaces or commas.

The instruction “To specify multiple recipients, separate each email address on a new line” works well.

But the result is not perfect :

Each email (on a new line) is between two symbols (a dot and a comma). Maybe only just the dot will be enough ?
Moreover there is no filter to check if an address is duplicated

So the issue needs works

madhavvyas’s picture

Issue tags: +Needs reroll
madhavvyas’s picture

Patch re-rolled #58

madhavvyas’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 62: contact_forms_ux-267492-62.patch, failed testing.

The last submitted patch, 62: contact_forms_ux-267492-62.patch, failed testing.

madhavvyas’s picture

Patch re rolled as per comment #57

Comment #60 task is pending

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

Version: 8.1.x-dev » 8.2.x-dev

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jibran’s picture

Status: Needs review » Needs work

Please update the issue summary.

+++ b/core/modules/contact/src/ContactFormListBuilder.php
@@ -34,8 +37,8 @@ public function buildRow(EntityInterface $entity) {
+      $row['recipients'] = $this->t('Selected user');
+      $row['selected'] = $this->t('No');

@@ -45,7 +48,7 @@ public function buildRow(EntityInterface $entity) {
+      $row['selected'] = ($default_form == $entity->id() ? $this->t('Yes') : $this->t('No'));

These changes are not needed.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

pameeela’s picture

Title: Long lists of recipient emails in admin/structure/contact does not wrap » Update storage of contact form email recipients
Issue summary: View changes
Issue tags: -Needs issue summary update +Bug Smash Initiative
Related issues: +#3111336: comma separated list of recipients is not working
FileSize
39.43 KB
31.71 KB

Updated the IS to reflect the current state. I tested and the spaces issue does not occur anymore on 9.0.3, at least from what I can tell? Tested entering a long list of emails without spaces and spaces get added on save. It works fine at various screen sizes. (Although a very long email address still breaks mobile, so the fact that the patch hides the column on mobile is good).

Do we still want to update this so that you can use newlines instead of commas? It would address this issue #3111336: comma separated list of recipients is not working.

No spaces:

After save:

AJV009 made their first commit to this issue’s fork.

AJV009’s picture

Assigned: Unassigned » AJV009
AJV009’s picture

Assigned: AJV009 » Unassigned
Status: Needs work » Needs review
FileSize
10.33 KB

Re rolled to 9.2.x

AJV009’s picture

Assigned: Unassigned » AJV009
AJV009’s picture

Previously had wrong version, just switched to 9.2 and confirmed
Please check the changes ->

Status: Needs review » Needs work

The last submitted patch, 82: contact_forms_ux-267492-82.patch, failed testing. View results

AJV009’s picture

Assigned: Unassigned » AJV009
Status: Needs work » Needs review
FileSize
10.2 KB

Fixed some more bugs

Status: Needs review » Needs work

The last submitted patch, 84: contact_forms_ux-267492-84.patch, failed testing. View results

AJV009’s picture

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Seems. the config is not updated after updating the form.

pameeela’s picture

Issue summary: View changes
pameeela’s picture

Status: Needs work » Closed (works as designed)

Discussed with @Lendude in Slack, there doesn't seem to be any bug here. The form works as described.

If adding the email addresses on new lines is strongly desirable, let's open a new feature request with the details and the reasoning. This issue is so old, it's best to close it to avoid confusion.