r105574 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105573‎ | r105574 | r105575 >
Date:19:16, 8 December 2011
Author:yonishostak
Status:resolved (Comments)
Tags:aft 
Comment:
AFTv5: Partial fix for #32842, fix categories for sample (underscore vs space)
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -648,10 +648,8 @@
649649 * holder
650650 */
651651 afterBuild: function () {
652 -
653652 // Default to 'suggestion'
654 - // $.articleFeedbackv5.currentBucket().selectTag( 'suggestion' );
655 -
 653+ $.articleFeedbackv5.currentBucket().selectTag( 'suggestion' );
656654 },
657655
658656 // }}}
Index: trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js
@@ -32,6 +32,13 @@
3333 'exclude': mw.config.get( 'wgArticleFeedbackv5BlacklistCategories', [] ),
3434 'current': mw.config.get( 'wgCategories', [] )
3535 };
 36+
 37+ // Categories are configures with underscores, but article's categories are returned with
 38+ // spaces instead. Revent to underscores here for sane comparison.
 39+ for( cat in categories['current'] ) {
 40+ categories['current'][cat] = categories['current'][cat].replace(/\s/gi, '_');
 41+ console.log(categories['current'][cat]);
 42+ }
3643
3744 // Category exclusion
3845 var disable = false;

Follow-up revisions

RevisionCommit summaryAuthorDate
r105903Fix indentation, comment typos and variable leakage in r105574catrope17:15, 12 December 2011
r107425Followup r105574 per CR: clone arrays from mw.config so we can modify them sa...catrope21:21, 27 December 2011

Comments

#Comment by TheDJ (talk | contribs)   21:10, 27 December 2011

'current': mw.config.get( 'wgCategories', [] ) categories['current'][cat] = categories['current'][cat].replace(/\s/gi, '_');


This breaks the wgCategories global, because it works on the reference of that array, instead of on a copy of that array. http://my.opera.com/GreyWyvern/blog/show.dml/1725165

Reported here: https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#wgCategories_returns_categories_with_underscores_instead_of_spaces_now.3F And confirmed with webkit inspector.

#Comment by Catrope (talk | contribs)   21:34, 27 December 2011

Trivial workaround committed in r107425 and deployed to the live site.

Status & tagging log