Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Prior to #2925064: [1/2] JS codestyle: no-restricted-syntax the site email address was copied to the user email address:
The browser also displays a javascript error in drupal.js?v=8.5.0-dev:13:
Uncaught TypeError: Array.prototype.push called on null or undefined
at push (<anonymous>)
at Array.forEach (<anonymous>)
at Object.attach (system.js?v=8.5.0-dev:13)
at drupal.js?v=8.5.0-dev:25
at Array.forEach (<anonymous>)
at Object.Drupal.attachBehaviors (drupal.js?v=8.5.0-dev:22)
at drupal.init.js:16
at HTMLDocument.t (ready.min.js?v=1.0.8:4)
Proposed resolution
- Restore the behavior where the entered site mail address is copied to the user email adress
- Fix the javascript error
Remaining tasks
- Write a patch
- Review
- Commit
User interface changes
The site email address in the install profile form is copied to the user email address
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#5 | system.patch | 1.32 KB | droplet |
#2 | site-mail-copied-to-user-mail.gif | 57.83 KB | idebr |
Comments
Comment #2
idebr CreditAttribution: idebr at ezCompany commentedComment #3
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedAssigning me and trying to reproduce this issue in 8.6.x-dev.
Comment #4
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedI can reproduce this issue on 8.6.x branch as well. Browser throw this error in console mentioned by @idebr on Configure site installation step. I think this issue is to do with https://github.com/ded/domready library used by drupal.
Comment #5
droplet CreditAttribution: droplet commentedComment #6
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedI can confirm patch #5 fixes this issue on 8.6.x branch. +1 @droplet for patch.
Comment #7
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedI am not sure if Javascript Test is required for this or not. Moving it to RTBC feel free to open again if TestCase is required or there is any other bug related to this.
Comment #8
alexpottGiven this is a regression introduced by a code style improvement I think we should commit the fix but open a followup for testing. Especially as this affects the 8.5.0 beta.
Committed 3840ad2 and pushed to 8.6.x. Thanks!
@msankhala thanks for reviewing the issue and testing it. Whilst your reviews didn't materially affect the patch you provided evidence of testing and how you did it. So I'm crediting you on d.o but not on the patch.
Comment #11
alexpottBackported to 8.5.x since this is a regression introduced in the development of that patch that could impact live site's UIs.
Committed 1cf6343 and pushed to 8.5.x. Thanks!
Comment #12
alexpottAdded test followup #2944089: Test Drupal.behaviors.copyFieldValue javascript
Comment #13
dawehnerIn case someone is curious why this doesn't work:
So, each bit of the forEach would push the value, index and array all the time. In order words, let's never be clever about these functions for build in functions.
Comment #14
dawehnerOn the positive side of things, we now have a bit more of an idea where we lack test coverage.