r55903 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55902‎ | r55903 | r55904 >
Date:22:53, 6 September 2009
Author:churchofemacs
Status:resolved (Comments)
Tags:
Comment:
Show change block / unblock link on Special:Contributions if user is blocked
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/specials/SpecialContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -161,12 +161,30 @@
162162 # Talk page link
163163 $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
164164 if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && IP::isIPAddress( $nt->getText() ) ) ) {
165 - # Block link
166 - if( $wgUser->isAllowed( 'block' ) )
167 - $tools[] = $sk->linkKnown(
168 - SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
169 - wfMsgHtml( 'blocklink' )
170 - );
 165+ if( $wgUser->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
 166+ if ( $wgUser->isBlocked() ) {
 167+ $tools[] = $sk->linkKnown( # Change block link
 168+ SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
 169+ wfMsgHtml( 'change-blocklink' )
 170+ );
 171+ $tools[] = $sk->linkKnown( # Unblock link
 172+ SpecialPage::getTitleFor( 'BlockList' ),
 173+ wfMsgHtml( 'unblocklink' ),
 174+ array(),
 175+ array(
 176+ 'action' => 'unblock',
 177+ 'ip' => $nt->getDBkey()
 178+ ),
 179+ array( 'known' )
 180+ );
 181+ }
 182+ else { # User is not blocked
 183+ $tools[] = $sk->linkKnown( # Block link
 184+ SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
 185+ wfMsgHtml( 'blocklink' )
 186+ );
 187+ }
 188+ }
171189 # Block log link
172190 $tools[] = $sk->linkKnown(
173191 SpecialPage::getTitleFor( 'Log' ),
Index: trunk/phase3/RELEASE-NOTES
@@ -207,6 +207,7 @@
208208 * Added $wgShowDBErrorBacktrace, to allow users to easily gather backtraces for
209209 database connection and query errors.
210210 * (bug 19646) New hook: ImgAuthBeforeStream for tests and functionality before file is streamed to user, but only when using img_auth
 211+* Show change block / unblock link on Special:Contributions if user is blocked
211212
212213 === Bug fixes in 1.16 ===
213214

Follow-up revisions

RevisionCommit summaryAuthorDate
r55904fixing error in r55903 - User object from userid is now used instead of wgUse...churchofemacs23:34, 6 September 2009
r56859Follow-up on r55909 and r55903: Note / block log excerpt and block/unblock li...churchofemacs22:48, 23 September 2009
r64607And while I'm a it, fix for r55903: canonical name is "Ipblocklist", not "Blo...ialex09:48, 5 April 2010

Comments

#Comment by Mr.Z-man (talk | contribs)   23:04, 6 September 2009

+ if ( $wgUser->isBlocked() ) {

Won't this check if the current user is blocked? Not the user whose contributions you're looking at?

Also, its not necessary to specify array( 'known' ) if you're using linkKnown

#Comment by Church of emacs (talk | contribs)   23:14, 6 September 2009

D'oh! You're right. We are dealing with two users in this case. Seems I picked the wrong one. I'll have a look into it again...

About the linkKnown: you are absolutely right. I'll remove it.

#Comment by Church of emacs (talk | contribs)   23:35, 6 September 2009

Done in r55904. Is everything okay now? :)

Status & tagging log