Remove optional survey link

Change-Id: If545873bb97b1da8ea5001dce575b1ef512903fb
This commit is contained in:
Sam Smith 2016-11-08 06:06:47 +00:00 committed by Phuedx
parent 19349c0108
commit 16adb1d738
4 changed files with 0 additions and 52 deletions

View file

@ -112,7 +112,6 @@ class PopupsHooks {
*/
public static function onResourceLoaderGetConfigVars( array &$vars ) {
$conf = ConfigFactory::getDefaultInstance()->makeConfig( 'popups' );
$vars['wgPopupsSurveyLink'] = $conf->get( 'PopupsSurveyLink' );
$vars['wgPopupsSchemaPopupsSamplingRate'] = $conf->get( 'SchemaPopupsSamplingRate' );
if ( $conf->get( 'PopupsExperiment' ) ) {

View file

@ -42,8 +42,6 @@
"config": {
"@PopupsBetaFeature": "@var bool: Whether the extension should be enabled as an opt-in beta feature. If true, the BetaFeatures extension must be installed. False by default.",
"PopupsBetaFeature": false,
"@PopupsSurveyLink": "@var bool|string: When defined a link will be rendered at the bottom of the popup for the user to provide feedback. The URL must start with https or http. If not, then an error is thrown client-side. The link is annotated with `rel=\"noreferrer\"` so no referrer information or `window.opener` is leaked to the survey hosting site (see https://html.spec.whatwg.org/multipage/semantics.html#link-type-noreferrer for more information).",
"PopupsSurveyLink": false,
"@SchemaPopupsSamplingRate": "@var number: Sample rate for logging events to Schema:Popups.",
"SchemaPopupsSamplingRate": 0,
"PopupsExperiment": false

View file

@ -8,7 +8,6 @@
var currentRequest,
isSafari = navigator.userAgent.match( /Safari/ ) !== null,
article = {},
surveyLink = mw.config.get( 'wgPopupsSurveyLink' ),
$window = $( window ),
CHARS = 525,
SIZES = {
@ -148,9 +147,6 @@
}
$div.find( '.mwe-popups-extract' )
.append( article.getProcessedElements( page.extract, page.title ) );
if ( surveyLink ) {
$div.find( 'footer' ).append( article.createSurveyLink( surveyLink ) );
}
mw.popups.render.cache[ href ].settings = {
title: page.title,
@ -162,32 +158,6 @@
return $div;
};
/**
* Creates a link to a survey, possibly hosted on an external site.
*
* @param {string} url
* @return {jQuery}
*/
article.createSurveyLink = function ( url ) {
if ( !/https?:\/\//.test( url ) ) {
throw new Error(
'The survey link URL, i.e. PopupsSurveyLink, must start with https or http.'
);
}
return $( '<a>' )
.attr( 'href', url )
.attr( 'target', '_blank' )
.attr( 'title', mw.message( 'popups-send-feedback' ) )
// Don't leak referrer information or `window.opener` to the survey hosting site. See
// https://html.spec.whatwg.org/multipage/semantics.html#link-type-noreferrer for more
// information.
.attr( 'rel', 'noreferrer' )
.addClass( 'mwe-popups-icon mwe-popups-survey-icon' );
};
/**
* Returns an array of elements to be appended after removing parentheses
* and making the title in the extract bold.

View file

@ -166,25 +166,6 @@
], true ), 120, 'Correct upper Y 2.' );
} );
QUnit.test( 'render.article.createSurveyLink', function ( assert ) {
var $surveyLink;
QUnit.expect( 2 );
$surveyLink = mw.popups.render.renderers.article.createSurveyLink( 'http://path/to/resource' );
assert.ok( /noreferrer/.test( $surveyLink.attr( 'rel' ) ), 'Survey link doesn\'t leak referrer information or `window.opener`' );
// ---
assert.throws(
function () {
mw.popups.render.renderers.article.createSurveyLink( 'htt://path/to/resource' );
},
new Error( 'The survey link URL, i.e. PopupsSurveyLink, must start with https or http.' )
);
} );
QUnit.test( 'render.article.createPopup', function ( assert ) {
var $popup, $thumbLink, $extractLink, cache;