mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 23:24:39 +00:00
Link Previews -> Page Previews
Change-Id: I08e80220c76a65cadaba20ce78b9eb2b36139095
This commit is contained in:
parent
089ee014ad
commit
b1b29f4704
|
@ -8,12 +8,12 @@ Accepted
|
|||
|
||||
## Context
|
||||
|
||||
The hardest part of debugging Link Previews issues (especially those related to
|
||||
The hardest part of debugging Page Previews issues (especially those related to
|
||||
EventLogging) was understanding the state of the system (the "state") and how
|
||||
it's mutated given some interaction(s). This was in no small part because the
|
||||
state was defined, initialized, and mutated in various parts of the codebase.
|
||||
|
||||
The state required for Link Previews to function isn't actually overly
|
||||
The state required for Page Previews to function isn't actually overly
|
||||
complicated. To keep things easy to debug/easy to reason about we should
|
||||
endeavour to isolate the state and its mutations from the various other parts of
|
||||
the system.
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
FETCH_START_DELAY = 500; // ms.
|
||||
|
||||
/**
|
||||
* Represents Link Previews booting.
|
||||
* Represents Page Previews booting.
|
||||
*
|
||||
* When a Redux store is created, the `@@INIT` action is immediately
|
||||
* dispatched to it. To avoid overriding the term, we refer to booting rather
|
||||
* than initializing.
|
||||
*
|
||||
* Link Previews persists critical pieces of information to local storage.
|
||||
* Since reading from and writing to local storage are synchronous, Link
|
||||
* Page Previews persists critical pieces of information to local storage.
|
||||
* Since reading from and writing to local storage are synchronous, Page
|
||||
* Previews is booted when the browser is idle (using
|
||||
* [`mw.requestIdleCallback`](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback))
|
||||
* so as not to impact latency-critical events.
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
/**
|
||||
* Given the global state of the application, creates a function that gets
|
||||
* whether or not the user should have Link Previews enabled, i.e. whether
|
||||
* whether or not the user should have Page Previews enabled, i.e. whether
|
||||
* they are in the experiment condition.
|
||||
*
|
||||
* The user is in the experiment condition if:
|
||||
* * They've enabled by Link Previews by clicking "Enable previews" in the
|
||||
* * They've enabled by Page Previews by clicking "Enable previews" in the
|
||||
* footer menu.
|
||||
* * They've enabled Link Previews as a beta feature.
|
||||
* * They've enabled Page Previews as a beta feature.
|
||||
* * They aren't in the control bucket of the experiment.
|
||||
*
|
||||
* @param {mw.Map} config
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
*
|
||||
* * The "Enable previews" link (the "link") is appended to the footer menu
|
||||
* (see `createFooterLink` above).
|
||||
* * When Link Previews are disabled, then the link is shown; otherwise, the
|
||||
* * When Page Previews are disabled, then the link is shown; otherwise, the
|
||||
* link is hidden.
|
||||
* * When the user clicks the link, then the `showSettings` bound action
|
||||
* creator is called.
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
return {
|
||||
|
||||
/**
|
||||
* Gets whether or not the user has previously enabled Link Previews.
|
||||
* Gets whether or not the user has previously enabled Page Previews.
|
||||
*
|
||||
* N.B. that if the user hasn't previously enabled or disabled Link
|
||||
* N.B. that if the user hasn't previously enabled or disabled Page
|
||||
* Previews, i.e. mw.popups.userSettings., then they are treated as if they have.
|
||||
*
|
||||
* @return {Boolean}
|
||||
|
@ -31,7 +31,7 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* Sets whether or not the user has enabled Link Previews.
|
||||
* Sets whether or not the user has enabled Page Previews.
|
||||
*
|
||||
* @param {Boolean} isEnabled
|
||||
*/
|
||||
|
@ -41,7 +41,7 @@
|
|||
|
||||
/**
|
||||
* Gets whether or not the user has previously enabled **or disabled**
|
||||
* Link Previews.
|
||||
* Page Previews.
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
|
@ -50,7 +50,7 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* Gets the user's Link Previews token.
|
||||
* Gets the user's Page Previews token.
|
||||
*
|
||||
* If the storage doesn't contain a token, then one is generated and
|
||||
* persisted to the storage before being returned.
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
assert.notOk( this.isUserInCondition() );
|
||||
} );
|
||||
|
||||
QUnit.test( 'it shouldn\'t bucket the user if they have enabled or disabled Link Previews', 2, function ( assert ) {
|
||||
QUnit.test( 'it shouldn\'t bucket the user if they have enabled or disabled Page Previews', 2, function ( assert ) {
|
||||
var userSettings = createStubUserSettings( /* hasIsEnabled = */ true ),
|
||||
getIsEnabledSpy = this.sandbox.spy( userSettings, 'getIsEnabled' ),
|
||||
isUserInCondition = mw.popups.createExperiment( this.config, this.user, userSettings );
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
href: '/wiki/File:foo.jpg'
|
||||
} ).appendTo( $container );
|
||||
|
||||
// Add a link that should have a Link Preview.
|
||||
// Add a link that should have a Page Preview.
|
||||
$( '<a>', {
|
||||
text: 'link with tooltip',
|
||||
title: 'link title',
|
||||
|
|
Loading…
Reference in a new issue