Do not output invalid links for deleted names on Special:Contributions
authorMatěj Suchánek <matejsuchanek97@gmail.com>
Sat, 25 Feb 2017 15:01:34 +0000 (15:01 +0000)
committerMatěj Suchánek <matejsuchanek97@gmail.com>
Sat, 25 Feb 2017 15:30:47 +0000 (15:30 +0000)
Steps to reproduce:
- have advanced user rights and go to Special:Contributions
- choose "Show contributions of new accounts only" and "Deleted only"
- examine rows with deleted user names, marked with
  "[username or IP address removed - edit hidden from contributions]"

All these rows have a red "(talk)" link which links to "User talk:"
(that's all). More detailed examination reveals an empty <a> element
which is supposed to link to the user page.

As these rows have the mentioned marker, we can just skip generating
user link if the user name is hidden.

Change-Id: I4fc7fb7ad2836834e9436ca2acb6b12484c15172

includes/specials/pagers/ContribsPager.php

index 47a2aed..a4740a4 100644 (file)
@@ -458,14 +458,13 @@ class ContribsPager extends ReverseChronologicalPager {
                        }
 
                        # Show user names for /newbies as there may be different users.
-                       # Note that we already excluded rows with hidden user names.
-                       if ( $this->contribs == 'newbie' ) {
+                       # Note that only unprivileged users have rows with hidden user names excluded.
+                       $userlink = '';
+                       if ( $this->contribs == 'newbie' && !$rev->isDeleted( Revision::DELETED_USER ) ) {
                                $userlink = ' . . ' . $lang->getDirMark()
                                        . Linker::userLink( $rev->getUser(), $rev->getUserText() );
                                $userlink .= ' ' . $this->msg( 'parentheses' )->rawParams(
-                                               Linker::userTalkLink( $rev->getUser(), $rev->getUserText() ) )->escaped() . ' ';
-                       } else {
-                               $userlink = '';
+                                       Linker::userTalkLink( $rev->getUser(), $rev->getUserText() ) )->escaped() . ' ';
                        }
 
                        $flags = [];