Page MenuHomePhabricator

It is not possible to know from which wiki's language version an email was sent
Open, LowestPublic

Description

I have recently received many emails from different users. I was nevertheless surprised not to find any information about the Wikipedia from where the email was sent. Only "Wikipedia" is indicated, but not the language version. The sender is Wikipédia <wiki@wikimedia.org>

Is it (only) possible to know this indirectly depending on the language of the footballer?
From the typography of the Wikipedia used?
Is this a problem related to the use of WMF farms, which have several wikis with the same name configured but with linguistic variations?

Event Timeline

Does it not say in the disclaimer text?

This email was sent by user "[]" on the English Wikipedia to user "[]". It has been automatically delivered and the Wikimedia Foundation cannot be held responsible for its contents.

EDIT

Turns out that disclaimer text may have changed? The above example was from an old Wikipedia email I had in my inbox. It now appears to be

This email was sent by [] to [] by the "Email this user" function at Wikipedia. If you reply to this email, your email will be sent directly to the original sender, revealing your email address to them.

https://en.wikipedia.org/wiki/MediaWiki:Emailuserfooter was manually set on enwiki, that explain why it's specified English Wikipedia :)

DannyS712 subscribed.

Train of thought for documentation purposes about potential approaches, chosen approach at the bottom:
Since the message was originally added in 2008 all it includes is {{SITENAME}}. Since all of the wikipedias have the same name, I suggest including the wiki id (or url) to note which version. Eg for eswiki, it could be ...Wikipedia (eswiki) or ...Wikipedia (es.wikipedia.org). There doesn't appear to be an easy way to get "Spanish Wikipedia" in core.

However, if we just want to fix this for WMF wikis, we can use the WikimediaMessages project-localized-name-* names and try to figure out how to replace the {{SITENAME}} with that. Parser::transformMsg() (which replaces the magic words) uses Parser::preprocess() which runs the ParserBeforePreprocess hook, maybe that could be used?

On the other hand, there doesn't seem to be an easy way to figure out whether the current parsing is being done for a specific message key, so perhaps we can abuse the EmailUser hook?

Given the text of the email, manually recreate the snippet from the emailuserfooter message that would have been appended. Then, make a copy of that, replacing the substituted value of {{SITENAME}} with the relevant localized name. Then replace the snippet in the email text to use the one with the local name. That could potentially have some other issues with it though...

On the other hand, we could also try intercepting the raw message content with the LocalisationCacheRecache hook, and directly replace the use of {{SITENAME}} with the localized version. Suggested approach:

  • for every message emailuserfooter when the cache is being rebuilt, replace {{SITENAME}} with a new magic variable {{LOCALIZEDSITENAME}}
  • add a handler for that magic variable to use the localized version of the site if it exists, if not just fallback to the default of {{SITENAME}}

better: instead of adding a new magic variable, just replace {{SITENAME}} with {{int:project-localized-name-*}} for the relevant project

even better: just replace with the actual localized name since it is available

DannyS712 triaged this task as Lowest priority.Mar 26 2022, 11:42 PM

Change 773861 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/WikimediaMessages@master] Used localized site name in `emailuserfooter` message

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

I'm sorry that I haven't handled this task. I recently returned from a long bout of unexpected inactivity, and while I plan to resume my contributions here on Phabricator its unfair to claim tasks that I might not work on when others may be interested in handling them. I'm removing myself as the assignee in a batch-action, but if someone feels that I really should be the one to handle this task feel free to re-assign me and I'll take a look.