Display warning message in Special:ListFiles when invalid username entered
authorTina Johnson <tinajohnson.1234@gmail.com>
Thu, 19 Mar 2015 15:34:50 +0000 (21:04 +0530)
committerUmherirrender <umherirrender_de.wp@web.de>
Sat, 11 Apr 2015 14:47:13 +0000 (14:47 +0000)
A warning message is to be displayed when an invalid username
is entered in Special:ListFiles. This patch does the same

Bug: T72784
Change-Id: I35fef559db812d347af7a313778e25f775e1bfb6

includes/specials/SpecialListfiles.php
languages/i18n/en.json
languages/i18n/qqq.json

index 7576c1f..2d79aaf 100644 (file)
@@ -90,9 +90,20 @@ class ImageListPager extends TablePager {
 
                if ( $userName !== null && $userName !== '' ) {
                        $nt = Title::newFromText( $userName, NS_USER );
+                       $user = User::newFromName( $userName, false );
                        if ( !is_null( $nt ) ) {
                                $this->mUserName = $nt->getText();
                        }
+                       if ( !$user || ( $user->isAnon() && !User::isIP( $user->getName() ) ) ) {
+                               $this->getOutput()->wrapWikiMsg(
+                                       "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
+                                       array(
+                                               'listfiles-userdoesnotexist',
+                                               wfEscapeWikiText( $userName ),
+                                       )
+                               );
+                       }
+
                }
 
                if ( $search !== '' && !$this->getConfig()->get( 'MiserMode' ) ) {
index e511502..bbd9455 100644 (file)
        "listfiles-delete": "delete",
        "listfiles-summary": "This special page shows all uploaded files.",
        "listfiles_search_for": "Search for media name:",
+       "listfiles-userdoesnotexist": "User account \"$1\" is not registered.",
        "imgfile": "file",
        "listfiles": "File list",
        "listfiles_thumb": "Thumbnail",
index 2bde387..e600208 100644 (file)
        "listfiles-delete": "Text of the delete links next to the entries on [[Special:ListFiles]], surrounded by parentheses.\n{{Identical|Delete}}",
        "listfiles-summary": "This message is displayed at the top of [[Special:ImageList]] to explain how to use that special page.",
        "listfiles_search_for": "Input label for the form displayed on [[Special:ListFiles]].",
+       "listfiles-userdoesnotexist": "This message is displayed on [[Special:ListFiles]] when a invalid username is entered.",
        "imgfile": "{{Identical|File}}",
        "listfiles": "Page title and grouping label for the form displayed on [[Special:ListFiles]].\n{{Identical|File list}}",
        "listfiles_thumb": "{{Identical|Thumbnail}}",