r94270 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94269‎ | r94270 | r94271 >
Date:19:14, 11 August 2011
Author:krinkle
Status:ok
Tags:
Comment:
Solve undefined-message problem by removing it all together. I've moved the .containsCat() check to before the $link.length/createCatLink code, now it's always defined.

(Follows-up r93351, r94268)
Modified paths:
  • /trunk/phase3/resources/mediawiki.page/mediawiki.page.ajaxCategories.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki.page/mediawiki.page.ajaxCategories.js
@@ -445,13 +445,8 @@
446446 * @return {jQuery}
447447 */
448448 createCatLink: function( catTitle ) {
449 - var catName = catTitle.getMainText();
450 -
451 - if ( this.containsCat( catName ) ) {
452 - return;
453 - }
454 -
455 - var $catLinkWrapper = $( this.options.catLinkWrapper ),
 449+ var catName = catTitle.getMainText(),
 450+ $catLinkWrapper = $( this.options.catLinkWrapper ),
456451 $anchor = $( '<a>' )
457452 .text( catName )
458453 .attr( {
@@ -528,20 +523,13 @@
529524 catName = catTitle.getMainText(),
530525 catFull = catTitle.toText();
531526
532 - if ( !$link.length ) {
533 - $link = this.createCatLink( catTitle );
534 - }
535 -
536527 if ( this.containsCat( catName ) ) {
537528 this.showError( mw.msg( 'ajax-category-already-present', catName ) );
538529 return this;
539530 }
540531
541 - // Sometimes createCatLink returns undefined/null, previously caused an exception
542 - // in the following lines, catching now.. @todo
543 - if ( !$link ) {
544 - this.showError( 'Unexpected error occurred. $link undefined.' );
545 - return this;
 532+ if ( !$link.length ) {
 533+ $link = this.createCatLink( catTitle );
546534 }
547535
548536 // Mark red if missing

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93351AjaxCategories rewrite:...krinkle00:43, 28 July 2011
r94268ajaxCategories fixes based on review in r93351 CR:...krinkle19:01, 11 August 2011

Status & tagging log