http://www.mediawiki.org/wiki/Special:Code/MediaWiki/94270

Revision: 94270
Author:   krinkle
Date:     2011-08-11 19:14:34 +0000 (Thu, 11 Aug 2011)
Log Message:
-----------
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: trunk/phase3/resources/mediawiki.page/mediawiki.page.ajaxCategories.js
===================================================================
--- trunk/phase3/resources/mediawiki.page/mediawiki.page.ajaxCategories.js      
2011-08-11 19:10:22 UTC (rev 94269)
+++ trunk/phase3/resources/mediawiki.page/mediawiki.page.ajaxCategories.js      
2011-08-11 19:14:34 UTC (rev 94270)
@@ -445,13 +445,8 @@
         * @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 = $( '<a>' )
                                .text( catName )
                                .attr( {
@@ -528,20 +523,13 @@
                        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


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to