Page MenuHomePhabricator

Accessing Special:PrivateDomains as an anon incorrectly links to Special:EmailUser for the contact person link
Open, Needs TriagePublic

Description

Accessing Special:PrivateDomains as an anon incorrectly links to Special:EmailUser for the contact person link. This shouldn't link to this page since anons can't use it.

Perhaps we could make it for anons link to that person's userpage instead, and make it configurable via a MediaWiki message in case if contact details aren't available on there (e.g wikis could link it to Project:Contact or Project:Administrators if they wanted to).

Event Timeline

PrivateDomains has a customized version of SpecialPage::displayRestrictionError in the PrivateDomains class (SpecialPrivateDomains.php). It currently uses the i18n msg privatedomains-ifemailcontact which does indeed contain a link to Special:EmailUser; I suppose the correct way to go about this is to check for the user's login state in PrivateDomains::displayRestrictionError and display a different, yet-to-be-created msg for anons. Wanna submit a patch?

Hi, I’d like to work on this task.
From the discussion, I understand the fix involves checking whether the user is logged in inside displayRestrictionError() and showing a different message for anonymous users instead of linking to Special:EmailUser.
Please let me know if this approach looks good or if there are any additional considerations.
Thanks!

Hi, I’d like to work on this task.
From the discussion, I understand the fix involves checking whether the user is logged in inside displayRestrictionError() and showing a different message for anonymous users instead of linking to Special:EmailUser.

Yup, that should be it. My previous comment on this task is almost 9 years old but I doubt the codebase has changed that much. 😅

In any case, I'm looking forward to your patch - please add me as a reviewer on gerrit once you've submitted it! 👍

Change #1260061 had a related patch set uploaded (by BHUVANSH855; author: Bhuvansh855):

[mediawiki/extensions/PrivateDomains@master] PrivateDomains: Fix EmailUser link for anonymous users

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

Hi @ashley, I’ve submitted a patch for this task:
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/PrivateDomains/+/1262865
The change updates displayRestrictionError() to check whether the user is logged in. Logged-in users still see the Special:EmailUser link, while anonymous users are shown a non-email contact message instead.
I’ve also added you as a reviewer on Gerrit. Please take a look when you have time. Thanks!