Page MenuHomePhabricator

Link to 'Mute preferences' should not be shown if there are no preferences
Open, Needs TriagePublic

Description

Problem
A link to Special:Mute was added in T218270. However, as @dom_walden points out in T218270#5351777 the link is still visable even if there are not mute options available. This results in the error message:

Mute features are unavailable. This might be because: you haven't confirmed your email address or the wiki administrator has disabled email features and/or email blacklist for this wiki.

This is a bad user experience. The link should not be shown if there's nothing the user can do. This is the equivalent to showing links the user does not have access to.

Proposed Solution
Override SpecialPage::userCanExecute() in SpecialMute and ensure that a user has "access" to execute the page. Then ensure that this method is being called before the link is displayed.

We will also need to overrided SpecialPage::checkPermissions() to ensure that the same error is shown (i.e. not an access denied error).

Event Timeline

If I'm understanding this right, this will not happen for any of WMF wikis but there's a chance this might happen for 3rd-party wikis and that's who we are catering to here. In that light, let's discuss how much effort this is before prioritizing it.

Override SpecialPage::userCanExecute() in SpecialMute and ensure that a user has "access" to execute the page. Then ensure that this >method is being called before the link is displayed.
We will also need to overrided SpecialPage::checkPermissions() to ensure that the same error is shown (i.e. not an access denied error).

You can also just do the check in SkinTemplate where the link is produced. There are already similar checks.

if ( $this->getUser()->isRegistered() && $this->getConfig()->get( 'EnableSpecialMute' ) ) {
   $nav_urls['mute'] = [ ... ];
}