Add config option for showing history link in page actions menu

Bug: T213352
Change-Id: I6a53a7303434b0fd374bc5b6ea2dbc8e760807e6
This commit is contained in:
Jan Drewniak 2019-03-07 21:50:57 +01:00
parent 69511f16b6
commit c0ab8046ac
4 changed files with 32 additions and 6 deletions

View File

@ -106,6 +106,19 @@ Controls whether page issues should be replaced with a "Page issues" link (false
Controls whether the talk option should be displayed at the top of the page. Controls whether the talk option should be displayed at the top of the page.
This will work for all pages except the main page. This will work for all pages except the main page.
#### $wgMinervaHistoryInPageActions
* Type: `Array`
* Default:
```php
[
'beta' => false,
'base' => false,
'amc' => true,
]
```
Controls whether the history link appears in the page actions menu.
#### $wgMinervaShowShareButton #### $wgMinervaShowShareButton
* Type: `Array` * Type: `Array`

View File

@ -74,6 +74,13 @@ class MinervaHooks {
$config->get( 'MinervaTalkAtTop' ) $config->get( 'MinervaTalkAtTop' )
) )
); );
$featureManager->registerFeature(
new MobileFrontend\Features\Feature(
'MinervaHistoryInPageActions',
'skin-minerva',
$config->get( 'MinervaHistoryInPageActions' )
)
);
} catch ( RuntimeException $e ) { } catch ( RuntimeException $e ) {
// features already registered... // features already registered...
// due to a bug it's possible for this to run twice // due to a bug it's possible for this to run twice
@ -207,6 +214,9 @@ class MinervaHooks {
=> $featureManager->isFeatureAvailableInContext( 'MinervaShareButton', $mobileContext ), => $featureManager->isFeatureAvailableInContext( 'MinervaShareButton', $mobileContext ),
SkinMinerva::OPTION_TOGGLING => true, SkinMinerva::OPTION_TOGGLING => true,
SkinMinerva::OPTION_MOBILE_OPTIONS => true, SkinMinerva::OPTION_MOBILE_OPTIONS => true,
SkinMinerva::OPTIONS_HISTORY_PAGE_ACTIONS => $featureManager->isFeatureAvailableForCurrentUser(
'MinervaHistoryInPageActions'
),
] ); ] );
} }
} }

View File

@ -38,6 +38,7 @@ class SkinMinerva extends SkinTemplate {
const OPTION_TOGGLING = 'toggling'; const OPTION_TOGGLING = 'toggling';
const OPTIONS_MOBILE_BETA = 'beta'; const OPTIONS_MOBILE_BETA = 'beta';
const OPTIONS_TALK_AT_TOP = 'talkAtTop'; const OPTIONS_TALK_AT_TOP = 'talkAtTop';
const OPTIONS_HISTORY_PAGE_ACTIONS = 'historyInPageActions';
/** @const LEAD_SECTION_NUMBER integer which corresponds to the lead section /** @const LEAD_SECTION_NUMBER integer which corresponds to the lead section
in editing mode */ in editing mode */
@ -111,6 +112,7 @@ class SkinMinerva extends SkinTemplate {
self::OPTION_TOGGLING => false, self::OPTION_TOGGLING => false,
self::OPTION_PAGE_ISSUES => false, self::OPTION_PAGE_ISSUES => false,
self::OPTIONS_TALK_AT_TOP => false, self::OPTIONS_TALK_AT_TOP => false,
self::OPTIONS_HISTORY_PAGE_ACTIONS => false,
]; ];
/** /**
@ -1158,9 +1160,7 @@ class SkinMinerva extends SkinTemplate {
$menu[] = $this->createWatchPageAction( $actions ); $menu[] = $this->createWatchPageAction( $actions );
} }
if ( if ( $this->getSkinOption( self::OPTIONS_HISTORY_PAGE_ACTIONS ) ) {
MediaWikiServices::getInstance()->getService( 'MobileFrontend.AMC.UserMode' )->isEnabled()
) {
$menu[] = $this->getHistoryPageAction( $actions ); $menu[] = $this->getHistoryPageAction( $actions );
} }
@ -1278,13 +1278,11 @@ class SkinMinerva extends SkinTemplate {
* pageActionMenu.mustache template. * pageActionMenu.mustache template.
*/ */
protected function getHistoryPageAction() { protected function getHistoryPageAction() {
$baseResult = [ return [
'class' => MinervaUI::iconClass( 'clock-gray' ), 'class' => MinervaUI::iconClass( 'clock-gray' ),
'text' => $this->msg( 'mobile-frontend-history' ), 'text' => $this->msg( 'mobile-frontend-history' ),
'href' => $this->getHistoryUrl( $this->getTitle() ) 'href' => $this->getHistoryUrl( $this->getTitle() )
]; ];
return $baseResult;
} }
/** /**

View File

@ -40,6 +40,11 @@
"beta": false, "beta": false,
"amc": true "amc": true
}, },
"MinervaHistoryInPageActions": {
"base": false,
"beta": false,
"amc": true
},
"MinervaShowCategoriesButton": { "MinervaShowCategoriesButton": {
"base": false, "base": false,
"beta": true "beta": true