Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fandom changes #29

Open
wants to merge 1 commit into
base: REL1_43
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions includes/PopupsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,6 @@ public function getConfigBitmaskFromUser( User $user ) {
return ( $this->conflictsWithNavPopupsGadget( $user ) ? self::NAV_POPUPS_ENABLED : 0 );
}

/**
* @return bool
*/
public function areDependenciesMet() {
if ( $this->config->get( 'PopupsGateway' ) === 'mwApiPlain' ) {
return $this->extensionRegistry->isLoaded( 'TextExtracts' )
&& $this->extensionRegistry->isLoaded( 'PageImages' );
}

return true;
}

/**
* Whether popups code should be shipped to $title
*
Expand Down
6 changes: 0 additions & 6 deletions includes/PopupsHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,6 @@ public function onBeforePageDisplay( $out, $skin ): void {
return;
}

if ( !$this->popupsContext->areDependenciesMet() ) {
$this->logger->error( 'Popups requires the PageImages extensions.
TextExtracts extension is required when using mwApiPlain gateway.' );
return;
}

$out->addModules( [ 'ext.popups' ] );
}

Expand Down
2 changes: 1 addition & 1 deletion resources/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/dist/index.js.map.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/gateway/mediawiki.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function createMediaWikiApiGateway( api, config ) {
function fetch( title ) {
return api.get( {
action: 'query',
prop: 'info|extracts|pageimages|revisions|info',
prop: 'info|articlesnippet|revisions|info|vignetteimages',
formatversion: 2,
redirects: true,
exintro: mw.config.get( 'wgPopupsTextExtractsIntroOnly', true ),
Expand All @@ -57,7 +57,8 @@ export default function createMediaWikiApiGateway( api, config ) {
titles: title,
smaxage: CACHE_LIFETIME,
maxage: CACHE_LIFETIME,
uselang: 'content'
uselang: 'content',
vigthumbsize: config.THUMBNAIL_SIZE
}, {
headers: {
'X-Analytics': 'preview=1',
Expand Down
2 changes: 1 addition & 1 deletion src/isPagePreviewsEnabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ export default function isPagePreviewsEnabled( user, userSettings, config ) {
}

// Registered users never can enable popup types at run-time.
return mw.user.options.get( 'popups' ) === '1' ? true : null;
return Number( mw.user.options.get( 'popups' ) ) === 1 ? true : null;
}