Select initial side bar visibility depends on user login state and defaults
Bug: T254230 Change-Id: If121b6c8187ef6b8562d135bd1c40403be3e9564
This commit is contained in:
parent
5b28e0b014
commit
ac140d53e6
|
@ -55,6 +55,18 @@ final class Constants {
|
||||||
public const CONFIG_KEY_DEFAULT_SKIN_VERSION_FOR_NEW_ACCOUNTS =
|
public const CONFIG_KEY_DEFAULT_SKIN_VERSION_FOR_NEW_ACCOUNTS =
|
||||||
'VectorDefaultSkinVersionForNewAccounts';
|
'VectorDefaultSkinVersionForNewAccounts';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public const CONFIG_KEY_DEFAULT_SIDEBAR_VISIBLE_FOR_AUTHORISED_USER =
|
||||||
|
'VectorDefaultSidebarVisibleForAuthorisedUser';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public const CONFIG_KEY_DEFAULT_SIDEBAR_VISIBLE_FOR_ANONYMOUS_USER =
|
||||||
|
'VectorDefaultSidebarVisibleForAnonymousUser';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
* @ingroup Skins
|
* @ingroup Skins
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Vector\Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* QuickTemplate subclass for Vector
|
* QuickTemplate subclass for Vector
|
||||||
* @ingroup Skins
|
* @ingroup Skins
|
||||||
|
@ -170,7 +172,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
|
|
||||||
'data-sidebar' => $this->buildSidebar(),
|
'data-sidebar' => $this->buildSidebar(),
|
||||||
// [todo] fetch user preference when logged in (T246427).
|
// [todo] fetch user preference when logged in (T246427).
|
||||||
'sidebar-visible' => true,
|
'sidebar-visible' => $this->isSidebarVisible(),
|
||||||
'msg-vector-action-toggle-sidebar' => $this->msg( 'vector-action-toggle-sidebar' )->text(),
|
'msg-vector-action-toggle-sidebar' => $this->msg( 'vector-action-toggle-sidebar' )->text(),
|
||||||
] + $this->getMenuProps();
|
] + $this->getMenuProps();
|
||||||
|
|
||||||
|
@ -259,6 +261,23 @@ class VectorTemplate extends BaseTemplate {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines wheather the initial state of sidebar is visible on not
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function isSidebarVisible() {
|
||||||
|
$skin = $this->getSkin();
|
||||||
|
if ( $skin->getUser()->isLoggedIn() ) {
|
||||||
|
return $this->getConfig()->get(
|
||||||
|
Constants::CONFIG_KEY_DEFAULT_SIDEBAR_VISIBLE_FOR_AUTHORISED_USER
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $this->getConfig()->get(
|
||||||
|
Constants::CONFIG_KEY_DEFAULT_SIDEBAR_VISIBLE_FOR_ANONYMOUS_USER
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render a series of portals
|
* Render a series of portals
|
||||||
*
|
*
|
||||||
|
|
|
@ -153,6 +153,12 @@
|
||||||
"VectorDefaultSkinVersionForNewAccounts": {
|
"VectorDefaultSkinVersionForNewAccounts": {
|
||||||
"value": "1",
|
"value": "1",
|
||||||
"description": "@var string:['2'|'1'] The version ('2' for latest, '1' for legacy) of the Vector skin to **set** for newly created user accounts. **The value is persisted as a user preference.** This configuration is not used for preexisting accounts (see VectorDefaultSkinVersionForExistingAccounts) and only ever executed once at new account creation time."
|
"description": "@var string:['2'|'1'] The version ('2' for latest, '1' for legacy) of the Vector skin to **set** for newly created user accounts. **The value is persisted as a user preference.** This configuration is not used for preexisting accounts (see VectorDefaultSkinVersionForExistingAccounts) and only ever executed once at new account creation time."
|
||||||
|
},
|
||||||
|
"VectorDefaultSidebarVisibleForAuthorisedUser": {
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"VectorDefaultSidebarVisibleForAnonymousUser": {
|
||||||
|
"value": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ServiceWiringFiles": [
|
"ServiceWiringFiles": [
|
||||||
|
|
Loading…
Reference in New Issue