Glaisher has uploaded a new change for review.
https://gerrit.wikimedia.org/r/184116
Change subject: Allow blocking talk page access and send email access optionally
......................................................................
Allow blocking talk page access and send email access optionally
Add two checkboxes for optionally disabling editing own talk page
and preventing from sending email to other users in block interface
at 'Get users'. Also fixed logging for multiple parameters; now uses
a userBlockLogFlags function.
Bug: T41213
Change-Id: Ic1d8378007f1f1f05ae665b64ccd78247be7f6f0
---
M i18n/en.json
M i18n/qqq.json
M specials/SpecialCheckUser.php
3 files changed, 67 insertions(+), 15 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CheckUser
refs/changes/16/184116/1
diff --git a/i18n/en.json b/i18n/en.json
index 60119ae..54c79e9 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -49,6 +49,8 @@
"checkuser-localonly": "Not unified",
"checkuser-massblock": "Block selected users",
"checkuser-massblock-text": "Selected accounts will be blocked
indefinitely, with autoblocking of IP addresses enabled and account creation
disabled.\nIP addresses will be blocked for one week for anonymous users only
and account creation will be disabled.",
+ "checkuser-blockemail" : "Prevent from sending email",
+ "checkuser-blocktalk" : "Prevent from editing their own talk page while
blocked",
"checkuser-blocktag": "Replace user pages with:",
"checkuser-blocktag-talk": "Replace talk pages with:",
"checkuser-massblock-commit": "Block selected users",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 05ee545..94d4bd8 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -68,6 +68,8 @@
"checkuser-massblock-text": "Used as intro text for the form
{{msg-mw|checkuser-massblock}}.",
"checkuser-blocktag": "[[File:Special-checkuser-get-users
en.png|thumb|Checkuser interface]]Used as checkbox label in
[[Special:CheckUser]].\n\nThis message is followed by \"tag\" input box. The
input box is for text which replaces the entire wikitext of the concerned
page.\n\nSee also:\n* {{msg-mw|Checkuser-blocktag-talk}}",
"checkuser-blocktag-talk": "[[File:Special-checkuser-get-users
en.png|thumb|Checkuser interface]]Used as checkbox label in
[[Special:CheckUser]].\n\nThis message is followed by \"talktag\" input box.
The input box is for text which replaces the entire wikitext of the concerned
page.\n\nSee also:\n* {{msg-mw|Checkuser-blocktag}}",
+ "checkuser-blockemail" : "Used as a label for a checkbox asking to
block email access.",
+ "checkuser-blocktalk" : "Used as a label for a checkbox asking to block
talk page access.",
"checkuser-massblock-commit": "Used as Submit button text in
[[Special:CheckUser]].\n{{Identical|Block selected users}}",
"checkuser-block-success": "Used as success message in
[[Special:CheckUser]].\n\nParameters:\n* $1 - a list of one or more
usernames\n* $2 - the number of usernames in <code>$1</code>\n\nSee also:\n*
{{msg-mw|Checkuser-block-failure}}\n* {{msg-mw|Checkuser-block-limit}}\n*
{{msg-mw|Checkuser-block-noreason}}",
"checkuser-block-failure": "Used as failure message in
[[Special:CheckUser]].\n\nSee also:\n* {{msg-mw|Checkuser-block-success}}\n*
{{msg-mw|Checkuser-block-limit}}\n* {{msg-mw|Checkuser-block-noreason}}",
diff --git a/specials/SpecialCheckUser.php b/specials/SpecialCheckUser.php
index c5b1ab1..3262d16 100644
--- a/specials/SpecialCheckUser.php
+++ b/specials/SpecialCheckUser.php
@@ -18,6 +18,8 @@
$user = trim( $user );
$reason = $request->getText( 'reason' );
$blockreason = $request->getText( 'blockreason' );
+ $disableUserTalk = $request->getBool( 'blocktalk' );
+ $disableEmail = $request->getBool( 'blockemail' );
$checktype = $request->getVal( 'checktype' );
$period = $request->getInt( 'period' );
$users = $request->getArray( 'users' );
@@ -49,7 +51,7 @@
# Perform one of the various submit operations...
if ( $request->wasPosted() ) {
if ( $request->getVal( 'action' ) === 'block' ) {
- $this->doMassUserBlock( $users, $blockreason,
$tag, $talkTag );
+ $this->doMassUserBlock( $users, $blockreason,
$disableUserTalk, $disableEmail, $tag, $talkTag );
} elseif ( !$this->checkReason( $reason ) ) {
$this->getOutput()->addWikiMsg(
'checkuser-noreason' );
} elseif ( $checktype == 'subuserips' ) {
@@ -207,10 +209,12 @@
* Block a list of selected users
* @param array $users
* @param string $reason
+ * @param bool $disableUserTalk
+ * @param bool $disableEmail
* @param string $tag
* @param string $talkTag
*/
- protected function doMassUserBlock( $users, $reason = '', $tag = '',
$talkTag = '' ) {
+ protected function doMassUserBlock( $users, $reason = '',
$disableUserTalk = 0, $disableEmail = 0, $tag = '', $talkTag = '' ) {
global $wgCheckUserMaxBlocks;
if ( empty( $users ) || $this->getUser()->isBlocked( false ) ) {
$this->getOutput()->addWikiMsg(
'checkuser-block-failure' );
@@ -222,7 +226,7 @@
$this->getOutput()->addWikiMsg(
'checkuser-block-noreason' );
return;
}
- $safeUsers = self::doMassUserBlockInternal( $users, $reason,
$tag, $talkTag );
+ $safeUsers = self::doMassUserBlockInternal( $users, $reason,
$disableUserTalk, $disableEmail, $tag, $talkTag );
if ( !empty( $safeUsers ) ) {
$lang = $this->getLanguage();
$n = count( $safeUsers );
@@ -234,16 +238,46 @@
}
/**
+ * Return a comma-delimited list of "flags" to be passed to the block
log
+ * @param bool $anonOnly
+ * @param bool $disableUserTalk
+ * @param bool $disableEmail
+ * @return string
+ */
+ protected static function userBlockLogFlags( $anonOnly,
$disableUserTalk, $disableEmail ) {
+ global $wgBlockAllowsUTEdit;
+ $flags = array();
+
+ if ( $anonOnly ) {
+ $flags[] = 'anononly';
+ }
+
+ if ( $wgBlockAllowsUTEdit && $disableUserTalk ) {
+ $flags[] = 'nousertalk';
+ }
+
+ if ( $disableEmail ) {
+ $flags[] = 'noemail';
+ }
+
+ $flags[] = 'nocreate';
+
+ return implode( ',', $flags );
+ }
+
+ /**
* Block a list of selected users
*
* @param $users Array
* @param $reason String
+ * @param bool $disableUserTalk
+ * @param bool $disableEmail
* @param $tag String: replaces user pages
* @param $talkTag String: replaces user talk pages
* @return Array: list of html-safe usernames
*/
- public static function doMassUserBlockInternal( $users, $reason = '',
$tag = '', $talkTag = '' ) {
- global $wgUser;
+ public static function doMassUserBlockInternal( $users, $reason = '',
$disableUserTalk = 0, $disableEmail = 0, $tag = '', $talkTag = '' ) {
+ global $wgBlockAllowsUTEdit, $wgUser;
$counter = $blockSize = 0;
$safeUsers = array();
@@ -280,8 +314,8 @@
$block->isHardblock( !IP::isIPAddress( $u->getName() )
);
$block->isAutoblocking( true );
$block->prevents( 'createaccount', true );
- $block->prevents( 'sendemail', false );
- $block->prevents( 'editownusertalk', false );
+ $block->prevents( 'sendemail', $disableEmail );
+ $block->prevents( 'editownusertalk', (
!$wgBlockAllowsUTEdit || $disableUserTalk ) );
$oldblock = Block::newFromTarget( $u->getName() );
if ( !$oldblock ) {
@@ -289,13 +323,17 @@
# Prepare log parameters
$logParams = array();
$logParams[] = $expirestr;
- if ( $anonOnly ) {
- $logParams[] = 'anononly';
- }
- $logParams[] = 'nocreate';
+ $logParams[] = self::userBlockLogFlags(
$anonOnly, $disableUserTalk, $disableEmail );
+
# Add log entry
- $log->addEntry( 'block', $userTitle, $reason,
$logParams );
+ $log->addEntry(
+ 'block',
+ $userTitle,
+ $reason,
+ $logParams
+ );
}
+
# Tag userpage! (check length to avoid mistakes)
if ( strlen( $tag ) > 2 ) {
$userpage->doEdit( $tag, $reason, EDIT_MINOR );
@@ -306,7 +344,6 @@
}
return $safeUsers;
}
-
/**
* Give a "no matches found for X" message.
* If $checkLast, then mention the last edit by this user or IP.
@@ -832,6 +869,7 @@
* List unique IPs used for each user in time order, list corresponding
user agent
*/
protected function doIPUsersRequest( $ip, $xfor = false, $reason = '',
$period = 0, $tag = '', $talkTag = '' ) {
+ global $wgBlockAllowsUTEdit;
$out = $this->getOutput();
$dbr = wfGetDB( DB_SLAVE );
@@ -1069,8 +1107,18 @@
'</tr><tr>' .
'<td>' . Xml::check( 'usettag', false,
array( 'id' => 'usettag' ) ) . '</td>' .
'<td>' . Xml::label( $this->msg(
'checkuser-blocktag-talk' )->escaped(), 'usettag' ) . '</td>' .
- '<td>' . Xml::input( 'talktag', 46,
$talkTag, array( 'id' => 'talktag' ) ) . '</td>' .
- '</tr></table>';
+ '<td>' . Xml::input( 'talktag', 46,
$talkTag, array( 'id' => 'talktag' ) ) . '</td>';
+ if ( $wgBlockAllowsUTEdit ) {
+ $s .= '</tr><tr>' .
+ '<td>' . Xml::check(
'blocktalk', false, array( 'id' => 'blocktalk' ) ) . '</td>' .
+ '<td>' . Xml::label(
$this->msg( 'checkuser-blocktalk' )->escaped(), 'blocktalk' ) . '</td>';
+ }
+ if ( SpecialBlock::canBlockEmail(
$this->getUser() ) ) {
+ $s .= '</tr><tr>' .
+ '<td>' . Xml::check(
'blockemail', false, array( 'id' => 'blockemail' ) ) . '</td>' .
+ '<td>' . Xml::label(
$this->msg( 'checkuser-blockemail' )->escaped(), 'blockemail' ) . '</td>';
+ }
+ $s .= '</tr></table>';
$s .= '<p>' . $this->msg( 'checkuser-reason'
)->escaped() . ' ';
$s .= Xml::input( 'blockreason', 46, '', array(
'maxlength' => '150', 'id' => 'blockreason' ) );
$s .= ' ' . Xml::submitButton( $this->msg(
'checkuser-massblock-commit' )->escaped(),
--
To view, visit https://gerrit.wikimedia.org/r/184116
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1d8378007f1f1f05ae665b64ccd78247be7f6f0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CheckUser
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits