Bmansurov has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/338293 )
Change subject: WIP: T157700 ...................................................................... WIP: T157700 Needs tests. Bug: T157700 Change-Id: I5307587b10f4849c4e82d3b064ff759121c2de67 --- M resources/ext.relatedArticles.readMore.bootstrap/index.js 1 file changed, 13 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RelatedArticles refs/changes/93/338293/1 diff --git a/resources/ext.relatedArticles.readMore.bootstrap/index.js b/resources/ext.relatedArticles.readMore.bootstrap/index.js index bf53014..6c05577 100644 --- a/resources/ext.relatedArticles.readMore.bootstrap/index.js +++ b/resources/ext.relatedArticles.readMore.bootstrap/index.js @@ -16,22 +16,28 @@ /** * Is RelatedArticles extension enabled for current user * - * Returns true if the user opted into the beta feature, otherwise - * user's session ID is used to determine the eligibility for RelatedArticles functionality, + * If the user is logged in: + * * returns true if the user opted in to the beta feature; + * * otherwise false. + * + * If the user is logged out user's session ID is used to + * determine the eligibility for RelatedArticles functionality, * based on the value of wgRelatedArticlesEnabledSamplingRate - * thus the function will result the same outcome as long as the browser - * hasn't been restarted or the cookie hasn't been cleared. + * (defaults to 90%) thus the function will result the same + * outcome as long as the browser hasn't been restarted or + * the cookie hasn't been cleared. * * @return {boolean} */ function isEnabledForCurrentUser() { var bucket, - samplingRate = mw.config.get( 'wgRelatedArticlesEnabledSamplingRate', 1 ); + samplingRate; - if ( mw.config.get( 'wgRelatedArticlesBetaFeatureEnabled' ) ) { - return true; + if ( !mw.user.isAnon() ) { + return mw.config.get( 'wgRelatedArticlesBetaFeatureEnabled' ); } + samplingRate = mw.config.get( 'wgRelatedArticlesEnabledSamplingRate', 0.9 ); bucket = mw.experiments.getBucket( { name: 'ext.relatedArticles.visibility', enabled: true, -- To view, visit https://gerrit.wikimedia.org/r/338293 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5307587b10f4849c4e82d3b064ff759121c2de67 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/RelatedArticles Gerrit-Branch: master Gerrit-Owner: Bmansurov <bmansu...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits