Page MenuHomePhabricator

Send email address confirmation emails in the language of the site the user registered on (instead of English language)
Closed, ResolvedPublic

Description

Followup task from WikiCon 2016.
Could not find an existing task about this; T42379 looks only slightly related.

Steps to reproduce:

  1. A German-speaking user registered on German de.wp on September 5th 2016.

Actual outcome:

  1. The user received a confirmation message in English language.
  2. The user was very irritated and wondered what the email is about. ("Do they want me to pay something?")

Expected outcome:
The email is in German language as the user registered on German Wikipedia.

Text of message (edited for privacy):

Someone, probably you, from IP address 12.345.678.90,
has registered an account "Abcdefgh1" with this email address on Wikipedia.
To confirm that this account really does belong to you and activate
email features on Wikipedia, open this link in your browser:
https://de.wikipedia.org/wiki/Special:ConfirmEmail/1234567890abcdef
If you did *not* register the account, follow this link
to cancel the email address confirmation:
https://de.wikipedia.org/wiki/Special:InvalidateEmail/1234567890abcdef
This confirmation code will expire at 21:18, 12 September 2016.


See Also:
T146574: Watchlist emails should be sent in the user's language
T4592: E-mail notifications (enotifs) are not sent in the recipient's user interface language
T29239: Confirmation email is not generated in Arabic

Details

Related Gerrit Patches:

Event Timeline

Aklapper created this task.Sep 20 2016, 2:12 PM
Nemo_bis triaged this task as High priority.Nov 6 2016, 12:43 PM
Nemo_bis added a project: Regression.
Nemo_bis added subscribers: Tgr, Anomie.

I reproduced this bug on de.wikipedia.org and it.wikipedia.org with default user language in a browser with accept-language:it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4.

This is a severe regression, probably related to AuthManager. The account registration confirmemail messages have "always" been sent in the correct language, even from multilingual wikis as long as one changed the interface language on Special:UserLogin. My archives mostly contain copies from the 2008–2010 period, but I see e.g. https://wiki.documentfoundation.org/Special:Version (1.24.6) still works correctly.

Tgr added a comment.Nov 7 2016, 1:05 AM

The control flow goes like this:

  1. the user is created, AuthManager::setDefaultUserOptions sets the language from the context language (which is probably wrong for account creation by admin, but not a problem here)
  2. user data gets saved, which calls User::clearInstanceCache (meaning the next user option read will load from DB)
  3. LoginSignupSpecialPage::setSessionUserForCurrentRequest sets $wgLang from the userlang parameter, and if that does not exist, from the user option
  4. transaction gets committed
  5. the mails are sent via User::sendConfirmationMail which uses $wgLang

So maybe the SELECT for the user option in step 3 misses the update in step 1 due to consistent reads.

Anomie added a comment.Nov 7 2016, 2:29 PM

That still shouldn't pick up English on dewiki, though. If the language wasn't set, it should be getting the content language for the local wiki.

I wasn't able to reproduce this on my local testing wiki, so I'll probably have to mess with mw1099 or the like to try to figure out what exactly is going on.

Change 320212 had a related patch set uploaded (by Anomie):
LoginSignupSpecialPage: Don't output empty 'uselang'

https://gerrit.wikimedia.org/r/320212

Anomie added a comment.Nov 7 2016, 4:00 PM

I wasn't able to reproduce this on my local testing wiki, so I'll probably have to mess with mw1099 or the like to try to figure out what exactly is going on.

It turns out it needs $wgLoginLanguageSelector = true to reproduce it.

Good catch, thanks! I had not thought of keeping that into account.

Anomie added a comment.Nov 7 2016, 7:52 PM

Wondering if this might also fix any of

No, it won't fix any of those. The bug here is that the account creation form included uselang= (empty string) in the submission, which caused it to set $wgLang and related settings incorrectly for the request-in-progress. None of those bugs appear to have anything to do with the account creation form.

Change 320212 merged by jenkins-bot:
LoginSignupSpecialPage: Don't output empty 'uselang'

https://gerrit.wikimedia.org/r/320212

Nemo_bis closed this task as Resolved.Nov 12 2016, 5:07 PM
Nemo_bis claimed this task.

Looks good now!

Hallo „T146147test3“!
Wir freuen uns, dass du dich bei Wikipedia registriert hast.
Bitte öffne den folgenden Link in deinem Browser, um deine E-Mail-Adresse zu bestätigen. So erfährst du zukünftig, wenn andere Wikipedia-Autorinnen und -Autoren mit dir in Kontakt treten möchten. Außerdem kannst du dir ein neues Passwort schicken lassen, falls du deins mal vergessen hast.

Anomie claimed this task.Nov 12 2016, 5:58 PM