Merge "Directly access the properties with non-static functions"

This commit is contained in:
jenkins-bot 2024-07-21 09:38:02 +00:00 committed by Gerrit Code Review
commit a5ab05be4e

View file

@ -101,12 +101,12 @@ class PopupsHooks implements
} }
$skinPosition = array_search( 'skin', array_keys( $prefs ) ); $skinPosition = array_search( 'skin', array_keys( $prefs ) );
$readingOptions = self::getPagePreviewPrefToggle( $user, $this->popupsContext ); $readingOptions = $this->getPagePreviewPrefToggle( $user );
if ( $this->config->get( 'PopupsReferencePreviews' ) ) { if ( $this->config->get( 'PopupsReferencePreviews' ) ) {
$readingOptions = array_merge( $readingOptions = array_merge(
$readingOptions, $readingOptions,
self::getReferencePreviewPrefToggle( $user, $this->popupsContext ) $this->getReferencePreviewPrefToggle( $user )
); );
} }
@ -124,10 +124,9 @@ class PopupsHooks implements
* Get Page Preview option * Get Page Preview option
* *
* @param User $user User whose preferences are being modified * @param User $user User whose preferences are being modified
* @param PopupsContext $context
* @return array[] * @return array[]
*/ */
private static function getPagePreviewPrefToggle( User $user, PopupsContext $context ) { private function getPagePreviewPrefToggle( User $user ) {
$option = [ $option = [
'type' => 'toggle', 'type' => 'toggle',
'label-message' => 'popups-prefs-optin', 'label-message' => 'popups-prefs-optin',
@ -135,7 +134,7 @@ class PopupsHooks implements
'section' => self::PREVIEWS_PREFERENCES_SECTION 'section' => self::PREVIEWS_PREFERENCES_SECTION
]; ];
if ( $context->conflictsWithNavPopupsGadget( $user ) ) { if ( $this->popupsContext->conflictsWithNavPopupsGadget( $user ) ) {
$option[ 'disabled' ] = true; $option[ 'disabled' ] = true;
$option[ 'help-message' ] = [ 'popups-prefs-disable-nav-gadgets-info', $option[ 'help-message' ] = [ 'popups-prefs-disable-nav-gadgets-info',
'Special:Preferences#mw-prefsection-gadgets' ]; 'Special:Preferences#mw-prefsection-gadgets' ];
@ -150,10 +149,9 @@ class PopupsHooks implements
* Get Reference Preview option * Get Reference Preview option
* *
* @param User $user User whose preferences are being modified * @param User $user User whose preferences are being modified
* @param PopupsContext $context
* @return array[] * @return array[]
*/ */
private static function getReferencePreviewPrefToggle( User $user, PopupsContext $context ) { private function getReferencePreviewPrefToggle( User $user ) {
$option = [ $option = [
'type' => 'toggle', 'type' => 'toggle',
'label-message' => 'popups-refpreview-user-preference-label', 'label-message' => 'popups-refpreview-user-preference-label',
@ -161,8 +159,8 @@ class PopupsHooks implements
'section' => self::PREVIEWS_PREFERENCES_SECTION 'section' => self::PREVIEWS_PREFERENCES_SECTION
]; ];
$isNavPopupsGadgetEnabled = $context->conflictsWithNavPopupsGadget( $user ); $isNavPopupsGadgetEnabled = $this->popupsContext->conflictsWithNavPopupsGadget( $user );
$isRefTooltipsGadgetEnabled = $context->conflictsWithRefTooltipsGadget( $user ); $isRefTooltipsGadgetEnabled = $this->popupsContext->conflictsWithRefTooltipsGadget( $user );
if ( $isNavPopupsGadgetEnabled && $isRefTooltipsGadgetEnabled ) { if ( $isNavPopupsGadgetEnabled && $isRefTooltipsGadgetEnabled ) {
$option[ 'disabled' ] = true; $option[ 'disabled' ] = true;