r89360 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89359‎ | r89360 | r89361 >
Date:20:10, 2 June 2011
Author:tparscal
Status:ok
Tags:
Comment:
Added weights to pitches, allowing them to be configured to be more likely to be chosen than others. Initially, the weights are 1/1/2 (survey/join/edit), giving edit a 2 in 4 chance if the user is not logged in and a 2 in 3 chance if they are.
Modified paths:
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js
@@ -662,7 +662,10 @@
663663 // the user has rejected this within 3 days of right now
664664 var display = $.cookie( prefix( 'pitch-' + key ) );
665665 if ( display !== 'hide' && context.options.pitches[key].condition() ) {
666 - pitches.push( key );
 666+ var weight = 'weight' in pitches ? pitches.weight : 1;
 667+ for ( var i = 0; i < weight; i++ ) {
 668+ pitches.push( key );
 669+ }
667670 }
668671 }
669672 if ( pitches.length ) {
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js
@@ -219,6 +219,7 @@
220220 },
221221 'pitches': {
222222 'survey': {
 223+ 'weight': 1,
223224 'condition': function() {
224225 return isPitchVisible( 'survey' );
225226 },
@@ -236,6 +237,7 @@
237238 'reject': 'articlefeedback-pitch-reject'
238239 },
239240 'join': {
 241+ 'weight': 1,
240242 'condition': function() {
241243 return isPitchVisible( 'join' ) && mw.user.anonymous();
242244 },
@@ -273,6 +275,7 @@
274276 }
275277 },
276278 'edit': {
 279+ 'weight': 2,
277280 'condition': function() {
278281 // An empty restrictions array means anyone can edit
279282 var restrictions = mw.config.get( 'wgRestrictionEdit' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r894441.17wmf1: MFT r89360, r89365, r89367catrope21:09, 3 June 2011

Status & tagging log