Warn when user trying to block nonexistent user
authorJuneHyeon Bae <devunt@gmail.com>
Fri, 30 May 2014 09:14:54 +0000 (18:14 +0900)
committerUmherirrender <umherirrender_de.wp@web.de>
Mon, 23 Feb 2015 19:14:27 +0000 (19:14 +0000)
Now, Special:Block/Some_User and Special:Block/No_Such_User act the
same. So show warning when user opened 'Special:Block/No_such_user'
page.

Bug: T37687
Change-Id: I60292e1016b64224a6146add58106c9028e7914c

includes/specials/SpecialBlock.php

index efe4888..c672817 100644 (file)
@@ -236,6 +236,14 @@ class SpecialBlock extends FormSpecialPage {
                # This will be overwritten by request data
                $fields['Target']['default'] = (string)$this->target;
 
+               if ( $this->target ) {
+                       $status = self::validateTarget( $this->target, $this->getUser() );
+                       if ( !$status->isOK() ) {
+                               $errors = $status->getErrorsArray();
+                               $this->preErrors = array_merge( $this->preErrors, $errors );
+                       }
+               }
+
                # This won't be
                $fields['PreviousTarget']['default'] = (string)$this->target;