Huji has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/372844 )

Change subject: Add option to block user/IP from editing their talk page
......................................................................

Add option to block user/IP from editing their talk page

Bug: T170014
Change-Id: Ief4c9123e04583cb87698c564b6f9819e3dc2b0c
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M includes/AbuseFilter.class.php
M includes/Views/AbuseFilterViewEdit.php
5 files changed, 9 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter 
refs/changes/44/372844/1

diff --git a/extension.json b/extension.json
index f8d3abc..e88082b 100644
--- a/extension.json
+++ b/extension.json
@@ -201,6 +201,7 @@
                        "disallow": true,
                        "blockautopromote": true,
                        "block": true,
+                       "blocktalk": true,
                        "rangeblock": false,
                        "degroup": true,
                        "tag": true,
diff --git a/i18n/en.json b/i18n/en.json
index 649fc3e..63e6e12 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -157,6 +157,7 @@
        "abusefilter-edit-action-blockautopromote": "Revoke the user's 
autoconfirmed status",
        "abusefilter-edit-action-degroup": "Remove the user from all privileged 
groups",
        "abusefilter-edit-action-block": "Block the user and/or IP address from 
editing",
+       "abusefilter-edit-action-blocktalk": "Block the user and/or IP address 
from editing their own talk page",
        "abusefilter-edit-action-throttle": "Trigger actions only if the user 
trips a rate limit",
        "abusefilter-edit-action-rangeblock": "Block the /16 range from which 
the user originates",
        "abusefilter-edit-action-tag": "Tag the edit for further review",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index a7aff88..fae5f53 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -188,6 +188,7 @@
        "abusefilter-edit-action-blockautopromote": 
"{{doc-abusefilter-action}}",
        "abusefilter-edit-action-degroup": "{{doc-abusefilter-action}}",
        "abusefilter-edit-action-block": "{{doc-abusefilter-action}}",
+       "abusefilter-edit-action-blocktalk": "{{doc-abusefilter-action}}",
        "abusefilter-edit-action-throttle": "{{doc-abusefilter-action}}",
        "abusefilter-edit-action-rangeblock": "{{doc-abusefilter-action}}",
        "abusefilter-edit-action-tag": "{{doc-abusefilter-action}}",
diff --git a/includes/AbuseFilter.class.php b/includes/AbuseFilter.class.php
index 4b1418f..fd99f50 100644
--- a/includes/AbuseFilter.class.php
+++ b/includes/AbuseFilter.class.php
@@ -1366,6 +1366,7 @@
                                break;
 
                        case 'block':
+                       case 'blocktalk':
                                global $wgAbuseFilterBlockDuration, 
$wgAbuseFilterAnonBlockDuration, $wgUser;
                                if ( $wgUser->isAnon() && 
$wgAbuseFilterAnonBlockDuration !== null ) {
                                        // The user isn't logged in and the 
anon block duration
@@ -1382,7 +1383,8 @@
                                        ],
                                        $wgUser->getName(),
                                        $expiry,
-                                       true
+                                       true,
+                                       $action === 'blocktalk'
                                );
 
                                $message = [
@@ -1524,7 +1526,7 @@
         * @param string $expiry
         * @param bool $isAutoBlock
         */
-       protected static function doAbuseFilterBlock( array $rule, $target, 
$expiry, $isAutoBlock ) {
+       protected static function doAbuseFilterBlock( array $rule, $target, 
$expiry, $isAutoBlock, $editOwnUserTalk = false ) {
                $filterUser = self::getFilterUser();
                $reason = wfMessage(
                        'abusefilter-blockreason',
@@ -1538,7 +1540,7 @@
                $block->isHardblock( false );
                $block->isAutoblocking( $isAutoBlock );
                $block->prevents( 'createaccount', true );
-               $block->prevents( 'editownusertalk', false );
+               $block->prevents( 'editownusertalk', $editOwnUserTalk );
                $block->mExpiry = SpecialBlock::parseExpiryInput( $expiry );
 
                $success = $block->insert();
diff --git a/includes/Views/AbuseFilterViewEdit.php 
b/includes/Views/AbuseFilterViewEdit.php
index d4f6cc1..e99ae40 100644
--- a/includes/Views/AbuseFilterViewEdit.php
+++ b/includes/Views/AbuseFilterViewEdit.php
@@ -843,7 +843,7 @@
                                // abusefilter-edit-action-blockautopromote
                                // abusefilter-edit-action-degroup, 
abusefilter-edit-action-block
                                // abusefilter-edit-action-throttle, 
abusefilter-edit-action-rangeblock
-                               // abusefilter-edit-action-tag
+                               // abusefilter-edit-action-tag, 
abusefilter-edit-action-blocktalk
                                $message = 'abusefilter-edit-action-' . $action;
                                $form_field = 'wpFilterAction' . ucfirst( 
$action );
                                $status = $set;

-- 
To view, visit https://gerrit.wikimedia.org/r/372844
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief4c9123e04583cb87698c564b6f9819e3dc2b0c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: Huji <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to