Cleanup: Drop unnecessary isLegacy checks
The has-logo property is redundant: The Sidebar in legacy is its own component. The logo is always rendered in the legacy sidebar. data-emphasized-sidebar-action can be unconditionally sent The legacy sidebar doesn't use it, so there is no need to conditionally add a check for legacy These two changes allow us to remove the isLegacy property in favor of the single use of the isLegacy method. Change-Id: Ie7ee3cec29b20d07db81799484627254d4a78f5f
This commit is contained in:
parent
1aab97ec03
commit
d24d858264
|
@ -59,9 +59,6 @@ class SkinVector extends SkinMustache {
|
||||||
*/
|
*/
|
||||||
private const OPT_OUT_LINK_TRACKING_CODE = 'vctw1';
|
private const OPT_OUT_LINK_TRACKING_CODE = 'vctw1';
|
||||||
|
|
||||||
/** @var bool */
|
|
||||||
private $isLegacy;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the legacy version of the skin is being used.
|
* Whether or not the legacy version of the skin is being used.
|
||||||
*
|
*
|
||||||
|
@ -82,9 +79,7 @@ class SkinVector extends SkinMustache {
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function __construct( $options = [] ) {
|
public function __construct( $options = [] ) {
|
||||||
// Legacy overrides
|
if ( $this->isLegacy() ) {
|
||||||
$this->isLegacy = $this->isLegacy();
|
|
||||||
if ( $this->isLegacy ) {
|
|
||||||
$options['scripts'] = [ 'skins.vector.legacy.js' ];
|
$options['scripts'] = [ 'skins.vector.legacy.js' ];
|
||||||
$options['styles'] = [ 'skins.vector.styles.legacy' ];
|
$options['styles'] = [ 'skins.vector.styles.legacy' ];
|
||||||
$options['template'] = 'skin-legacy';
|
$options['template'] = 'skin-legacy';
|
||||||
|
@ -151,9 +146,8 @@ class SkinVector extends SkinMustache {
|
||||||
'msg-vector-action-toggle-sidebar' => $skin->msg( 'vector-action-toggle-sidebar' )->text(),
|
'msg-vector-action-toggle-sidebar' => $skin->msg( 'vector-action-toggle-sidebar' )->text(),
|
||||||
] + $this->getMenuProps();
|
] + $this->getMenuProps();
|
||||||
|
|
||||||
// The following logic is unqiue to Vector (not used by legacy Vector) and
|
if ( $skin->getUser()->isLoggedIn() ) {
|
||||||
// is planned to be moved in a follow-up patch.
|
// Note: This data is also passed to legacy template where it is unused.
|
||||||
if ( !$this->isLegacy && $skin->getUser()->isLoggedIn() ) {
|
|
||||||
$commonSkinData['data-sidebar']['data-emphasized-sidebar-action'] = [
|
$commonSkinData['data-sidebar']['data-emphasized-sidebar-action'] = [
|
||||||
'href' => SpecialPage::getTitleFor(
|
'href' => SpecialPage::getTitleFor(
|
||||||
'Preferences',
|
'Preferences',
|
||||||
|
@ -342,7 +336,6 @@ class SkinVector extends SkinMustache {
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'has-logo' => $this->isLegacy,
|
|
||||||
'html-logo-attributes' => Xml::expandAttributes(
|
'html-logo-attributes' => Xml::expandAttributes(
|
||||||
Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) + [
|
Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) + [
|
||||||
'class' => 'mw-wiki-logo',
|
'class' => 'mw-wiki-logo',
|
||||||
|
|
|
@ -4,11 +4,9 @@
|
||||||
}}
|
}}
|
||||||
|
|
||||||
<div id="mw-panel">
|
<div id="mw-panel">
|
||||||
{{#has-logo}}
|
|
||||||
<div id="p-logo" role="banner">
|
<div id="p-logo" role="banner">
|
||||||
<a {{{html-logo-attributes}}}></a>
|
<a {{{html-logo-attributes}}}></a>
|
||||||
</div>
|
</div>
|
||||||
{{/has-logo}}
|
|
||||||
{{#data-portals-first}}{{>Menu}}{{/data-portals-first}}
|
{{#data-portals-first}}{{>Menu}}{{/data-portals-first}}
|
||||||
{{#array-portals-rest}}{{>Menu}}{{/array-portals-rest}}
|
{{#array-portals-rest}}{{>Menu}}{{/array-portals-rest}}
|
||||||
{{#data-portals-languages}}{{>Menu}}{{/data-portals-languages}}
|
{{#data-portals-languages}}{{>Menu}}{{/data-portals-languages}}
|
||||||
|
|
|
@ -17,12 +17,10 @@ export const SIDEBAR_TEMPLATE_PARTIALS = {
|
||||||
|
|
||||||
export const SIDEBAR_DATA = {
|
export const SIDEBAR_DATA = {
|
||||||
withNoPortals: {
|
withNoPortals: {
|
||||||
'has-logo': true,
|
|
||||||
'array-portals-rest': [],
|
'array-portals-rest': [],
|
||||||
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
||||||
},
|
},
|
||||||
withPortalsAndOptOut: {
|
withPortalsAndOptOut: {
|
||||||
'has-logo': false,
|
|
||||||
'data-portals-first': PORTALS.navigation,
|
'data-portals-first': PORTALS.navigation,
|
||||||
'data-emphasized-sidebar-action': {
|
'data-emphasized-sidebar-action': {
|
||||||
href: '#',
|
href: '#',
|
||||||
|
@ -37,7 +35,6 @@ export const SIDEBAR_DATA = {
|
||||||
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
||||||
},
|
},
|
||||||
withPortals: {
|
withPortals: {
|
||||||
'has-logo': true,
|
|
||||||
'data-portals-first': PORTALS.navigation,
|
'data-portals-first': PORTALS.navigation,
|
||||||
'array-portals-rest': [
|
'array-portals-rest': [
|
||||||
PORTALS.toolbox,
|
PORTALS.toolbox,
|
||||||
|
@ -47,7 +44,6 @@ export const SIDEBAR_DATA = {
|
||||||
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
'html-logo-attributes': HTML_LOGO_ATTRIBUTES
|
||||||
},
|
},
|
||||||
withoutLogo: {
|
withoutLogo: {
|
||||||
'has-logo': false,
|
|
||||||
'data-portals-languages': PORTALS.langlinks,
|
'data-portals-languages': PORTALS.langlinks,
|
||||||
'array-portals-first': PORTALS.navigation,
|
'array-portals-first': PORTALS.navigation,
|
||||||
'array-portals-rest': [
|
'array-portals-rest': [
|
||||||
|
@ -56,7 +52,6 @@ export const SIDEBAR_DATA = {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
thirdParty: {
|
thirdParty: {
|
||||||
'has-logo': true,
|
|
||||||
'array-portals-rest': [
|
'array-portals-rest': [
|
||||||
PORTALS.toolbox,
|
PORTALS.toolbox,
|
||||||
PORTALS.navigation,
|
PORTALS.navigation,
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
* @property {MenuDefinition} data-portals-languages
|
* @property {MenuDefinition} data-portals-languages
|
||||||
* @property {MenuDefinition} data-portals-first
|
* @property {MenuDefinition} data-portals-first
|
||||||
* @property {MenuDefinition[]} array-portals-rest
|
* @property {MenuDefinition[]} array-portals-rest
|
||||||
* @property {boolean} [has-logo] whether to show a logo or not.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue