mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 17:00:37 +00:00
Merge "Fix settings dialog offering ReferencePreviews when unavailable"
This commit is contained in:
commit
d7869a0086
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.map.json
vendored
BIN
resources/dist/index.js.map.json
vendored
Binary file not shown.
|
@ -181,7 +181,8 @@ function registerChangeListeners(
|
|||
pagePreviewGateway = createPagePreviewGateway( mw.config ),
|
||||
referenceGateway = createReferenceGateway(),
|
||||
userSettings = createUserSettings( mw.storage ),
|
||||
settingsDialog = createSettingsDialogRenderer( mw.config ),
|
||||
referencePreviewsState = isReferencePreviewsEnabled( mw.user, userSettings, mw.config ),
|
||||
settingsDialog = createSettingsDialogRenderer( referencePreviewsState !== null ),
|
||||
experiments = createExperiments( mw.experiments ),
|
||||
statsvTracker = getStatsvTracker( mw.user, mw.config, experiments ),
|
||||
pageviewTracker = getPageviewTracker( mw.config ),
|
||||
|
@ -193,8 +194,7 @@ function registerChangeListeners(
|
|||
initiallyEnabled = {
|
||||
[ previewTypes.TYPE_PAGE ]:
|
||||
createIsPagePreviewsEnabled( mw.user, userSettings, mw.config ),
|
||||
[ previewTypes.TYPE_REFERENCE ]:
|
||||
isReferencePreviewsEnabled( mw.user, userSettings, mw.config )
|
||||
[ previewTypes.TYPE_REFERENCE ]: referencePreviewsState
|
||||
};
|
||||
|
||||
// If debug mode is enabled, then enable Redux DevTools.
|
||||
|
|
|
@ -8,10 +8,10 @@ import { previewTypes } from '../preview/model';
|
|||
/**
|
||||
* Create the settings dialog shown to anonymous users.
|
||||
*
|
||||
* @param {boolean} isReferencePreviewsInBeta
|
||||
* @param {boolean} referencePreviewsAvaliable
|
||||
* @return {JQuery} settings dialog
|
||||
*/
|
||||
export function createSettingsDialog( isReferencePreviewsInBeta ) {
|
||||
export function createSettingsDialog( referencePreviewsAvaliable ) {
|
||||
const choices = [
|
||||
{
|
||||
id: previewTypes.TYPE_PAGE,
|
||||
|
@ -26,7 +26,7 @@ export function createSettingsDialog( isReferencePreviewsInBeta ) {
|
|||
];
|
||||
|
||||
// TODO: Remove when not in Beta any more
|
||||
if ( isReferencePreviewsInBeta ) {
|
||||
if ( !referencePreviewsAvaliable ) {
|
||||
// Anonymous users can't access reference previews as long as they are in beta
|
||||
choices.splice( 1, 1 );
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ import { createSettingsDialog } from './settingsDialog';
|
|||
* Creates a render function that will create the settings dialog and return
|
||||
* a set of methods to operate on it
|
||||
*
|
||||
* @param {mw.Map} config
|
||||
* @param {boolean} referencePreviewsAvaliable
|
||||
* @return {Function} render function
|
||||
*/
|
||||
export default function createSettingsDialogRenderer( config ) {
|
||||
export default function createSettingsDialogRenderer( referencePreviewsAvaliable ) {
|
||||
/**
|
||||
* Cached settings dialog
|
||||
*
|
||||
|
@ -33,7 +33,7 @@ export default function createSettingsDialogRenderer( config ) {
|
|||
*/
|
||||
return ( boundActions ) => {
|
||||
if ( !$dialog ) {
|
||||
$dialog = createSettingsDialog( config.get( 'wgPopupsReferencePreviewsBetaFeature' ) );
|
||||
$dialog = createSettingsDialog( referencePreviewsAvaliable );
|
||||
$overlay = $( '<div>' ).addClass( 'mwe-popups-overlay' );
|
||||
|
||||
// Setup event bindings
|
||||
|
|
Loading…
Reference in a new issue