https://www.mediawiki.org/wiki/Special:Code/MediaWiki/108295

Revision: 108295
Author:   ashley
Date:     2012-01-07 00:39:08 +0000 (Sat, 07 Jan 2012)
Log Message:
-----------
Comments: allow removing anonymous users from your ignore list. 
User::idFromName() returns null for anons, so we have to handle that here.

Modified Paths:
--------------
    trunk/extensions/Comments/SpecialCommentIgnoreList.php

Modified: trunk/extensions/Comments/SpecialCommentIgnoreList.php
===================================================================
--- trunk/extensions/Comments/SpecialCommentIgnoreList.php      2012-01-06 
23:07:01 UTC (rev 108294)
+++ trunk/extensions/Comments/SpecialCommentIgnoreList.php      2012-01-07 
00:39:08 UTC (rev 108295)
@@ -43,6 +43,11 @@
                } else {
                        if( $wgRequest->wasPosted() ) {
                                $user_id = User::idFromName( $user_name );
+                               // Anons can be comment-blocked, but idFromName 
returns nothing
+                               // for an anon, so...
+                               if ( !$user_id ) {
+                                       $user_id = 0;
+                               }
                                $c = new Comment( 0 );
                                $c->deleteBlock( $wgUser->getID(), $user_id );
                                if( $user_id && class_exists( 'UserStatsTrack' 
) ) {
@@ -108,7 +113,7 @@
                        '</div>
                        <div>
                                <form action="" method="post" 
name="comment_block">
-                                       <input type="hidden" name="' . 
$user_name . '" />
+                                       <input type="hidden" name="user" 
value="' . $user_name . '" />
                                        <input type="button" 
class="site-button" value="' . wfMsg( 'comment-ignore-unblock' ) . '" 
onclick="document.comment_block.submit()" />
                                        <input type="button" 
class="site-button" value="' . wfMsg( 'comment-ignore-cancel' ) . '" 
onclick="history.go(-1)" />
                                </form>


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to