r55909 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55908‎ | r55909 | r55910 >
Date:01:29, 7 September 2009
Author:churchofemacs
Status:resolved
Tags:
Comment:
Display note on Special:Contributions if user is blocked, and provide an excerpt from the block log
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/specials/SpecialContributions.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES
@@ -208,6 +208,8 @@
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
211211 * Show change block / unblock link on Special:Contributions if user is blocked
 212+* Display note on Special:Contributions if the user is blocked, and provide an
 213+ excerpt from the block log.
212214
213215 === Bug fixes in 1.16 ===
214216
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2839,6 +2839,7 @@
28402840 'sp-contributions-logs' => 'logs',
28412841 'sp-contributions-talk' => 'talk',
28422842 'sp-contributions-userrights' => 'user rights management',
 2843+'sp-contributions-blocked-notice'=> 'This user is currently blocked. The latest block log entry is provided below for reference:',
28432844 'sp-contributions-search' => 'Search for contributions',
28442845 'sp-contributions-username' => 'IP Address or username:',
28452846 'sp-contributions-submit' => 'Search',
Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -223,6 +223,7 @@
224224 wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) );
225225
226226 $links = $wgLang->pipeList( $tools );
 227+ $this->showBlock( $nt );
227228 }
228229
229230 // Old message 'contribsub' had one parameter, but that doesn't work for
@@ -237,6 +238,37 @@
238239 }
239240
240241 /**
 242+ * Show a note if the user is blocked and display the last block log entry.
 243+ * @param Title $nt Title object for the target
 244+ */
 245+ protected function showBlock( $nt ) {
 246+ global $wgUser, $wgOut;
 247+ $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut );
 248+ $pager = new LogPager( $loglist, 'block', false, $nt->getPrefixedText() );
 249+ // Check if there is something in the block log.
 250+ // If this is not the case, either the user is not blocked,
 251+ // or the account has been hidden via hideuser.
 252+ if( $pager->getNumRows() > 0 ) {
 253+ $pager->mLimit = 1; # Show only latest log entry.
 254+ $wgOut->addHTML( '<div class="mw-warning-with-logexcerpt">' );
 255+ $wgOut->addWikiMsg( 'sp-contributions-blocked-notice' );
 256+ $wgOut->addHTML(
 257+ $loglist->beginLogEventsList() .
 258+ $pager->getBody() .
 259+ $loglist->endLogEventsList()
 260+ );
 261+ if( $pager->getNumRows() > $pager->mLimit ) {
 262+ $wgOut->addHTML( $wgUser->getSkin()->link(
 263+ SpecialPage::getTitleFor( 'Log', 'block' ),
 264+ wfMsgHtml( 'log-fulllog' ),
 265+ array(),
 266+ array( 'page' => $nt->getPrefixedText() )
 267+ ) );
 268+ }
 269+ $wgOut->addHTML( '</div>' );
 270+ }
 271+ }
 272+ /**
241273 * Generates the namespace selector form with hidden attributes.
242274 * @param $this->opts Array: the options to be included.
243275 */

Follow-up revisions

RevisionCommit summaryAuthorDate
r55918fixing r55909: checking if the user is _currently_ blocked before displaying ...churchofemacs12:04, 7 September 2009
r55924fixing r55909. Adding new message to messages.incchurchofemacs13:28, 7 September 2009
r56687Follow-up on r55909: showLogExtract can now tell Pager to ignore wgRequest of...churchofemacs22:07, 20 September 2009
r56859Follow-up on r55909 and r55903: Note / block log excerpt and block/unblock li...churchofemacs22:48, 23 September 2009

Status & tagging log