diff --git a/extension.json b/extension.json index 9bf745ddf..9113616da 100644 --- a/extension.json +++ b/extension.json @@ -67,15 +67,13 @@ "LogHeaders": { "abusefilter": "abusefilter-log-header" }, - "LogActions": { - "suppress/hide-afl": "abusefilter-logentry-suppress", - "suppress/unhide-afl": "abusefilter-logentry-unsuppress" - }, "LogActionsHandlers": { "abusefilter/hit": "AbuseLogHitFormatter", "abusefilter/modify": "AbuseFilterModifyLogFormatter", "abusefilter/create": "AbuseFilterModifyLogFormatter", - "abusefilterprivatedetails/access": "LogFormatter" + "abusefilterprivatedetails/access": "LogFormatter", + "suppress/hide-afl": "AbuseFilterSuppressLogFormatter", + "suppress/unhide-afl": "AbuseFilterSuppressLogFormatter" }, "ActionFilteredLogs": { "abusefilter": { @@ -120,6 +118,7 @@ "SpecialAbuseFilter": "includes/special/SpecialAbuseFilter.php", "AbuseLogHitFormatter": "includes/AbuseLogHitFormatter.php", "AbuseFilterModifyLogFormatter": "includes/AbuseFilterModifyLogFormatter.php", + "AbuseFilterSuppressLogFormatter": "includes/AbuseFilterSuppressLogFormatter.php", "AbuseFilterViewList": "includes/Views/AbuseFilterViewList.php", "AbuseFilterPager": "includes/pagers/AbuseFilterPager.php", "GlobalAbuseFilterPager": "includes/pagers/GlobalAbuseFilterPager.php", diff --git a/i18n/en.json b/i18n/en.json index c500cdf42..42985b0d9 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -95,12 +95,13 @@ "abusefilter-log-hide-reason": "Reason:", "abusefilter-log-hide-reason-other": "Other/additional reason:", "abusefilter-log-hide-forbidden": "You do not have permission to hide abuse log entries.", - "abusefilter-logentry-suppress": "hid \"[[$1]]\"", - "abusefilter-logentry-unsuppress": "unhid \"[[$1]]\"", + "abusefilter-log-entry-suppress": "$1 {{GENDER:$2|hid}} $3", + "abusefilter-log-entry-unsuppress": "$1 {{GENDER:$2|unhid}} $3", "logentry-abusefilter-hit": "$1 {{GENDER:$2|triggered}} $4, {{GENDER:$2|performing}} the action \"$5\" on $3. Actions taken: $6 ($7)", "log-action-filter-abusefilter": "Type of filter change:", "log-action-filter-abusefilter-create": "New filter creation", "log-action-filter-abusefilter-modify": "Filter modification", + "log-action-filter-suppress-abuselog": "Abuse log suppression", "logentry-abusefilterprivatedetails-access": "$1 {{GENDER:$2|accessed}} private details for $3", "abusefilterprivatedetails-log-name": "AbuseFilter private details access log", "abusefilter-management": "Abuse filter management", diff --git a/i18n/qqq.json b/i18n/qqq.json index 5a1ced3ee..a1a748b53 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -128,12 +128,13 @@ "abusefilter-log-hide-reason": "{{Identical|Reason}}", "abusefilter-log-hide-reason-other": "{{Identical|Other/additional reason}}", "abusefilter-log-hide-forbidden": "Message shown instead of a \"hide log entry\" form when not having the correct user rights.", - "abusefilter-logentry-suppress": "Log entry when hiding an abuse filter log entry. Parameters:\n* $1 is a link to the log ID with the log ID as description.", - "abusefilter-logentry-unsuppress": "Log entry when unhiding an abuse filter log entry. Parameters:\n* $1 is a link to the log ID with the log ID as description.", + "abusefilter-log-entry-suppress": "Log entry when hiding an abuse filter log entry. Parameters:\n* $1 - a link to a user page with a user name as link text, followed by a series of related links\n* $2 - raw username, for GENDER support\n* $3 – a link to the log ID.", + "abusefilter-log-entry-unsuppress": "Log entry when unhiding an abuse filter log entry. Parameters:\n* $1 - a link to a user page with a user name as link text, followed by a series of related links\n* $2 - raw username, for GENDER support\n* $3 – a link to the log ID.", "logentry-abusefilter-hit": "This message is for a log entry. Parameters:\n* $1 - user who performed the action\n* $2 - user who performed the action (to be used with GENDER)\n* $3 - link to the page, that the action that triggered the filter was made on\n* $4 - link to filter\n* $5 - action by user, like 'edit', 'move', 'create' etc.\n* $6 - actions taken by the filter\n* $7 - action details link", "log-action-filter-abusefilter": "{{doc-log-action-filter-action|abusefilter}}", "log-action-filter-abusefilter-create": "{{doc-log-action-filter-action|abusefilter|create}}", "log-action-filter-abusefilter-modify": "{{doc-log-action-filter-action|abusefilter|modify}}", + "log-action-filter-suppress-abuselog": "{{doc-log-action-filter-action|suppress|abuselog}}", "logentry-abusefilterprivatedetails-access": "This message is for a log entry. Parameters:\n* $1 User who accessed the private logs\n* $2 User who accessed the private logs (used for gender)\n* $3 The log entry of which private details were accessed", "abusefilterprivatedetails-log-name": "Log name", "abusefilter-management": "Title of [[Special:AbuseFilter]]", diff --git a/includes/AbuseFilterHooks.php b/includes/AbuseFilterHooks.php index 30024595c..1692bac6c 100644 --- a/includes/AbuseFilterHooks.php +++ b/includes/AbuseFilterHooks.php @@ -18,7 +18,7 @@ class AbuseFilterHooks { */ public static function onRegistration() { global $wgAbuseFilterAvailableActions, $wgAbuseFilterRestrictedActions, - $wgAuthManagerAutoConfig; + $wgAuthManagerAutoConfig, $wgActionFilteredLogs; if ( isset( $wgAbuseFilterAvailableActions ) || isset( $wgAbuseFilterRestrictedActions ) ) { wfWarn( '$wgAbuseFilterAvailableActions and $wgAbuseFilterRestrictedActions have been ' @@ -32,6 +32,12 @@ class AbuseFilterHooks { // Run after normal preauth providers to keep the log cleaner 'sort' => 5, ]; + + $wgActionFilteredLogs['suppress'] = array_merge( + $wgActionFilteredLogs['suppress'], + // Message: log-action-filter-suppress-abuselog + [ 'abuselog' => [ 'hide-afl', 'unhide-afl' ] ] + ); } /** diff --git a/includes/AbuseFilterSuppressLogFormatter.php b/includes/AbuseFilterSuppressLogFormatter.php new file mode 100644 index 000000000..b547b02b9 --- /dev/null +++ b/includes/AbuseFilterSuppressLogFormatter.php @@ -0,0 +1,16 @@ +entry->getSubtype() === 'unhide-afl' ) { + return 'abusefilter-log-entry-unsuppress'; + } else { + return 'abusefilter-log-entry-suppress'; + } + } + +} diff --git a/includes/special/SpecialAbuseLog.php b/includes/special/SpecialAbuseLog.php index 00891d652..a1a19c514 100644 --- a/includes/special/SpecialAbuseLog.php +++ b/includes/special/SpecialAbuseLog.php @@ -321,10 +321,12 @@ class SpecialAbuseLog extends SpecialPage { $this->msg( 'colon-separator' )->inContentLanguage()->text() . $fields['reason']; } - $logPage = new LogPage( 'suppress' ); $action = $fields['hidden'] ? 'hide-afl' : 'unhide-afl'; - - $logPage->addEntry( $action, $this->getPageTitle( $logid ), $reason ); + $logEntry = new ManualLogEntry( 'suppress', $action ); + $logEntry->setPerformer( $this->getUser() ); + $logEntry->setTarget( $this->getPageTitle( $logid ) ); + $logEntry->setComment( $reason ); + $logEntry->insert(); $this->getOutput()->redirect( SpecialPage::getTitleFor( 'AbuseLog' )->getFullURL() );