r50638 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50637‎ | r50638 | r50639 >
Date:18:04, 15 May 2009
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
bug 18613 Make filling in the "reason" field for CheckUser checks compulsory
Modified paths:
  • /trunk/extensions/CheckUser/CheckUser.i18n.php (modified) (history)
  • /trunk/extensions/CheckUser/CheckUser_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CheckUser/CheckUser_body.php
@@ -245,7 +245,8 @@
246246 if( !empty( $safeUsers ) ) {
247247 $n = count( $safeUsers );
248248 $ulist = $wgLang->listToText( $safeUsers );
249 - $wgOut->addWikiText( wfMsgExt( 'checkuser-block-success', 'parsemag', $ulist, $wgLang->formatNum( $n ) ) );
 249+ $wgOut->addWikiText( wfMsgExt( 'checkuser-block-success', 'parsemag',
 250+ $ulist, $wgLang->formatNum( $n ) ) );
250251 } else {
251252 $wgOut->addWikiText( wfMsgExt( 'checkuser-block-failure', 'parsemag' ) );
252253 }
@@ -317,7 +318,13 @@
318319 $wgOut->addHTML( $s );
319320 return;
320321 }
321 -
 322+
 323+ # Demand that a reason be given
 324+ if( !$reason ) {
 325+ $wgOut->addWikiText( wfMsgExt('checkuser-noreason',array('parsemag')) );
 326+ return;
 327+ }
 328+ # Record check...
322329 if( !$this->addLogEntry( 'userips', 'user', $user, $reason, $user_id ) ) {
323330 $wgOut->addHTML( '<p>'.wfMsgHtml('checkuser-log-fail').'</p>' );
324331 }
@@ -438,6 +445,11 @@
439446 if( $xfor ) {
440447 $logType .= '-xff';
441448 }
 449+ # Demand that a reason be given
 450+ if( !$reason ) {
 451+ $wgOut->addWikiText( wfMsgExt('checkuser-noreason',array('parsemag')) );
 452+ return;
 453+ }
442454 # Record check...
443455 if( !$this->addLogEntry( $logType, 'ip', $ip, $reason ) ) {
444456 $wgOut->addWikiMsg( 'checkuser-log-fail' );
@@ -582,6 +594,11 @@
583595 return;
584596 }
585597
 598+ # Demand that a reason be given
 599+ if( !$reason ) {
 600+ $wgOut->addWikiText( wfMsgExt('checkuser-noreason',array('parsemag')) );
 601+ return;
 602+ }
586603 # Record check...
587604 if( !$this->addLogEntry( 'useredits', 'user', $user, $reason, $user_id ) ) {
588605 $wgOut->addHTML( '<p>'.wfMsgHtml('checkuser-log-fail').'</p>' );
@@ -700,6 +717,11 @@
701718 if( $xfor ) {
702719 $logType .= '-xff';
703720 }
 721+ # Demand that a reason be given
 722+ if( !$reason ) {
 723+ $wgOut->addWikiText( wfMsgExt('checkuser-noreason',array('parsemag')) );
 724+ return;
 725+ }
704726 # Log the check...
705727 if( !$this->addLogEntry( $logType, 'ip', $ip, $reason ) ) {
706728 $wgOut->addHTML( '<p>'.wfMsgHtml('checkuser-log-fail').'</p>' );
Index: trunk/extensions/CheckUser/CheckUser.i18n.php
@@ -60,6 +60,7 @@
6161 'checkuser-block-failure' => '\'\'\'No users blocked.\'\'\'',
6262 'checkuser-block-limit' => 'Too many users selected.',
6363 'checkuser-block-noreason' => 'You must give a reason for the blocks.',
 64+ 'checkuser-noreason' => 'You must give a reason for this query.',
6465 'checkuser-accounts' => '$1 new {{PLURAL:$1|account|accounts}}',
6566 'checkuser-too-many' => 'Too many results, please narrow down the CIDR.
6667 Here are the IPs used (5000 max, sorted by address):',

Follow-up revisions

RevisionCommit summaryAuthorDate
r51040Added $wgCheckUserForceSummary and removed some code duplication from r50638aaron01:47, 27 May 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   19:13, 18 May 2009

This feels like a bunch of duplicate code; surely better to centralize the validation check?

#Comment by Tim Starling (talk | contribs)   15:35, 26 May 2009

Should be configurable, off by default. Wikimedia is not the only site that uses the CheckUser extension.

Status & tagging log