From 9c52dda64bd513951b72f73989c8cc7f2e44f3fb Mon Sep 17 00:00:00 2001 From: Krinkle Date: Thu, 11 Aug 2011 19:14:34 +0000 Subject: [PATCH] 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) --- .../mediawiki.page.ajaxCategories.js | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/resources/mediawiki.page/mediawiki.page.ajaxCategories.js b/resources/mediawiki.page/mediawiki.page.ajaxCategories.js index 2b3b021a06..986aaa4131 100644 --- a/resources/mediawiki.page/mediawiki.page.ajaxCategories.js +++ b/resources/mediawiki.page/mediawiki.page.ajaxCategories.js @@ -445,13 +445,8 @@ mw.ajaxCategories.prototype = { * @return {jQuery} */ createCatLink: function( catTitle ) { - var catName = catTitle.getMainText(); - - if ( this.containsCat( catName ) ) { - return; - } - - var $catLinkWrapper = $( this.options.catLinkWrapper ), + var catName = catTitle.getMainText(), + $catLinkWrapper = $( this.options.catLinkWrapper ), $anchor = $( '' ) .text( catName ) .attr( { @@ -528,20 +523,13 @@ mw.ajaxCategories.prototype = { catName = catTitle.getMainText(), catFull = catTitle.toText(); - if ( !$link.length ) { - $link = this.createCatLink( catTitle ); - } - if ( this.containsCat( catName ) ) { this.showError( mw.msg( 'ajax-category-already-present', catName ) ); return this; } - // Sometimes createCatLink returns undefined/null, previously caused an exception - // in the following lines, catching now.. @todo - if ( !$link ) { - this.showError( 'Unexpected error occurred. $link undefined.' ); - return this; + if ( !$link.length ) { + $link = this.createCatLink( catTitle ); } // Mark red if missing -- 2.20.1