r105471 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105470‎ | r105471 | r105472 >
Date:22:40, 7 December 2011
Author:gregchiasson
Status:resolved (Comments)
Tags:aft 
Comment:
AFTv5 - JS fixes on feedback page - I think there was an issue with wikiScript being called before mw.util had loaded, so I moved that call into the existing .ready() call, which appears to have resolved the isues.
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js
@@ -1,18 +1,15 @@
22 ( function ( $ ) {
33 $.articleFeedbackv5special = {};
44
5 - // TODO: Pass this in from the PHP side. Add it to mwConfig or w/e?
6 - //$.articleFeedbackv5special.page = mw.config.get( 'wgPageId' );
 5+ // TODO: Pass this in better from the PHP side.
76 $.articleFeedbackv5special.page = hackPageId;
87 $.articleFeedbackv5special.filter = 'all';
98 $.articleFeedbackv5special.sort = 'newest';
109 $.articleFeedbackv5special.limit = 25;
1110 $.articleFeedbackv5special.offset = 0;
1211 $.articleFeedbackv5special.showing = 0;
 12+ $.articleFeedbackv5special.apiUrl = undefined;
1313
14 - $.articleFeedbackv5special.apiUrl = mw.util.wikiScript('api'); //config.get( 'wgScriptPath' ) + '/api.php';
15 -
16 -
1714 $.articleFeedbackv5special.setBinds = function() {
1815 $( '#aft5-filter' ).bind( 'change', function(e) {
1916 $.articleFeedbackv5special.filter = $(this).val();
@@ -110,8 +107,14 @@
111108 } )( jQuery );
112109
113110 $( document ).ready( function() {
 111+ // This was failing sometimes when it was in the function above.
 112+ // I think it maky have been a race condition.
 113+ $.articleFeedbackv5special.apiUrl = mw.util.wikiScript('api');
 114+
114115 // Blank out the 'loading' text
115116 $( '#aft5-show-feedback' ).text( ' ' );
 117+
 118+ // Set up event binds and do initial data fetch.
116119 $.articleFeedbackv5special.setBinds();
117120 $.articleFeedbackv5special.loadFeedback();
118121 } );

Follow-up revisions

RevisionCommit summaryAuthorDate
r109965AFT5 - add mediawiki.util dependency for Special page, per r105471. Not sure ...gregchiasson22:45, 24 January 2012
r112376follow-up to r105471 - reverting changes now that dependancy is declaredkaldari00:00, 25 February 2012

Comments

#Comment by Krinkle (talk | contribs)   22:42, 7 December 2011

Your module should be indicated have a dependency on the 'mediawiki.util' module.

#Comment by Krinkle (talk | contribs)   22:42, 7 December 2011

That'll fix any race condition (which will be more common on slower connections, it's a must)

#Comment by Catrope (talk | contribs)   16:52, 12 December 2011

Yeah, that would fix the race condition if this file was even loaded using ResourceLoader at all, which it's not. But that's a whole 'nother story.

Marking fixme because this change should be reverted once the file is loaded through RL.

Status & tagging log