mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-28 09:30:17 +00:00
Do not show create account link for private wikis.
- Add conditional to check for 'createaccount' permissions based on config. - Update relevant template to show/hide create account markup. Note that this solution excludes the use case of extensions using core hooks to disable account creation. See https://phabricator.wikimedia.org/T288428#7303233. Bug: T288428 Change-Id: I89852207ee42f5ddd07e5dd6141461c6bfbcd5ac
This commit is contained in:
parent
92e034fbe7
commit
cd2a186469
|
@ -263,8 +263,17 @@ class SkinVector extends SkinMustache {
|
|||
], false );
|
||||
|
||||
$templateParser = $this->getTemplateParser();
|
||||
// See T288428#7303233. The following conditional checks whether config is disabling account creation for
|
||||
// anonymous users in modern Vector. This check excludes the use case of extensions using core and legacy hooks
|
||||
// to remove the "Create account" link from the personal toolbar. Ideally this should be managed with a new hook
|
||||
// that tracks account creation ability.
|
||||
// Supporting removing items via hook involves unnecessary additional complexity we'd rather avoid at this time.
|
||||
// (see https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/713505/3)
|
||||
// Account creation can be disabled by setting `$wgGroupPermissions['*']['createaccount'] = false;`
|
||||
$isCreateAccountAllowed = $isAnon && $this->getAuthority()->isAllowed( 'createaccount' );
|
||||
$userMoreHtmlItems = $templateParser->processTemplate( 'UserLinks__more', [
|
||||
'is-anon' => $isAnon,
|
||||
'is-create-account-allowed' => $isCreateAccountAllowed,
|
||||
'html-create-account' => $htmlCreateAccount,
|
||||
'data-user-interface-preferences' => $menuData[ 'data-user-interface-preferences' ],
|
||||
'data-notifications' => $menuData[ 'data-notifications' ],
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{{#data-user-interface-preferences}}{{{html-items}}}{{/data-user-interface-preferences}}
|
||||
{{#is-anon}}
|
||||
{{#is-create-account-allowed}}
|
||||
<li id="p-createaccount" class="user-links-collapsible-item">
|
||||
{{{html-create-account}}}
|
||||
</li>
|
||||
{{/is-anon}}
|
||||
{{/is-create-account-allowed}}
|
||||
{{^is-anon}}
|
||||
{{#data-user-page}}{{{html-items}}}{{/data-user-page}}
|
||||
{{#data-notifications}}{{{html-items}}}{{/data-notifications}}
|
||||
|
|
Loading…
Reference in a new issue