Jackmcbarn has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/183301

Change subject: Don't hide filter IDs
......................................................................

Don't hide filter IDs

We show filter names even for private filters. There's no reason we
shouldn't show filter IDs too.

Change-Id: I5076c28245753fcf95fdab1efb09faf4822efe6d
---
M api/ApiQueryAbuseLog.php
M i18n/en.json
M i18n/qqq.json
M modules/red_x.png
M modules/yes_check.png
M special/SpecialAbuseLog.php
6 files changed, 35 insertions(+), 77 deletions(-)


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

diff --git a/api/ApiQueryAbuseLog.php b/api/ApiQueryAbuseLog.php
index 397ee03..b8bd76e 100644
--- a/api/ApiQueryAbuseLog.php
+++ b/api/ApiQueryAbuseLog.php
@@ -63,18 +63,6 @@
                if ( $fld_details && !$user->isAllowed( 
'abusefilter-log-detail' ) ) {
                        $this->dieUsage( 'You don\'t have permission to view 
detailed abuse log entries', 'permissiondenied' );
                }
-               // Match permissions for viewing events on private filters to 
SpecialAbuseLog (bug 42814)
-               if ( $params['filter'] && !( AbuseFilterView::canViewPrivate() 
|| $user->isAllowed( 'abusefilter-log-private' ) ) ) {
-                       // A specific filter parameter is set but the user 
isn't allowed to view all filters
-                       if ( !is_array( $params['filter'] ) ) {
-                               $params['filter'] = array( $params['filter'] );
-                       }
-                       foreach( $params['filter'] as $filter ) {
-                               if ( AbuseFilter::filterHidden( $filter ) ) {
-                                       $this->dieUsage( 'You don\'t have 
permission to view log entries for private filters', 'permissiondenied' );
-                               }
-                       }
-               }
 
                $result = $this->getResult();
 
@@ -160,10 +148,7 @@
                        $entry = array();
                        if ( $fld_ids ) {
                                $entry['id'] = intval( $row->afl_id );
-                               $entry['filter_id'] = '';
-                               if ( $canSeeDetails ) {
-                                       $entry['filter_id'] = $row->afl_filter;
-                               }
+                               $entry['filter_id'] = $row->afl_filter;
                        }
                        if ( $fld_filter ) {
                                $entry['filter'] = $row->af_public_comments;
diff --git a/i18n/en.json b/i18n/en.json
index 1ed8fcf..402b4c4 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -47,9 +47,8 @@
        "abusefilter-log-search-title": "Title:",
        "abusefilter-log-search-wiki": "Wiki:",
        "abusefilter-log-search-submit": "Search",
-       "abusefilter-log-entry": "$1: $2 triggered an abuse filter, performing 
the action \"$3\" on $4.\nActions taken: $5;\nFilter description: $6",
-       "abusefilter-log-entry-withdiff": "$1: $2 triggered an abuse filter, 
performing the action \"$3\" on $4.\nActions taken: $5;\nFilter description: $6 
($7)",
        "abusefilter-log-detailedentry-meta": "$1: $2 triggered $3, performing 
the action \"$4\" on $5.\nActions taken: $6;\nFilter description: $7 ($8)",
+       "abusefilter-log-detailedentry-meta-nolinks": "$1: $2 triggered $3, 
performing the action \"$4\" on $5.\nActions taken: $6;\nFilter description: 
$7",
        "abusefilter-log-detailedentry-global": "global filter $1",
        "abusefilter-log-detailedentry-local": "filter $1",
        "abusefilter-log-detailslink": "details",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 8132069..22e8893 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -75,9 +75,8 @@
        "abusefilter-log-search-title": "Field label in abuse filter log 
page.\n{{Identical|Title}}",
        "abusefilter-log-search-wiki": "Label for text field that allows the 
user to limit search results to a specific wiki, by name.\n{{Identical|Wiki}}",
        "abusefilter-log-search-submit": "Button text to search log in abuse 
filter log page.\n{{Identical|Search}}",
-       "abusefilter-log-entry": "This message is for a log entry. 
Parameters:\n* $1 - timestamp\n* $2 - user\n* $3 - action by user\n* $4 - link 
to page the action that triggered the filter was made on\n* $5 - actions taken 
by the filter\n* $6 - comments in filter 
description\n{{Related|Abusefilter-log}}",
-       "abusefilter-log-entry-withdiff": "This message is for a log entry. 
Parameters:\n* $1 - timestamp\n* $2 - user\n* $3 - action by user\n* $4 - link 
to page the action that triggered the filter was made on\n* $5 - actions taken 
by the filter\n* $6 - comments in filter description\n* $7 - link to 
diff\n{{Related|Abusefilter-log}}",
        "abusefilter-log-detailedentry-meta": "This message is for a log entry. 
Parameters:\n* $1 - timestamp\n* $2 - user\n* $3 - link to filter\n* $4 - 
action by user\n* $5 - link to page the action that triggered the filter was 
made on\n* $6 - actions taken by the filter\n* $7 - comments in filter 
description\n* $8 - link to action details, examine, and optional diff\n* $9 - 
(Optional) raw username, for GENDER support\n{{Related|Abusefilter-log}}",
+       "abusefilter-log-detailedentry-meta-nolinks": "This message is for a 
log entry. Parameters:\n* $1 - timestamp\n* $2 - user\n* $3 - link to filter\n* 
$4 - action by user\n* $5 - link to page the action that triggered the filter 
was made on\n* $6 - actions taken by the filter\n* $7 - comments in filter 
description\n* $8 - (Optional) raw username, for GENDER 
support\n{{Related|Abusefilter-log}}",
        "abusefilter-log-detailedentry-global": "Addition in the abuse filter 
log detail when a filter rule is a global rule. Parameters:\n* $1 is a global 
filter ID.",
        "abusefilter-log-detailedentry-local": "Addition in the abuse filter 
log detail when a filter rule is a local rule. Parameters:\n* $1 is a local 
filter ID.\n{{Identical|Filter}}",
        "abusefilter-log-detailslink": "Link text for a link to abuse filter 
log details.\n{{Identical|Detail}}",
diff --git a/modules/red_x.png b/modules/red_x.png
index d491cde..f8b0115 100644
--- a/modules/red_x.png
+++ b/modules/red_x.png
Binary files differ
diff --git a/modules/yes_check.png b/modules/yes_check.png
index 582e86d..5da0823 100644
--- a/modules/yes_check.png
+++ b/modules/yes_check.png
Binary files differ
diff --git a/special/SpecialAbuseLog.php b/special/SpecialAbuseLog.php
index aead4be..c08a0b3 100644
--- a/special/SpecialAbuseLog.php
+++ b/special/SpecialAbuseLog.php
@@ -238,20 +238,6 @@
 
                if ( $this->mSearchFilter ) {
                        $searchFilters = array_map( 'trim', explode( '|', 
$this->mSearchFilter ) );
-                       // if a filter is hidden, users who can't view private 
filters should not be able to find log entries generated by it
-                       if( !AbuseFilterView::canViewPrivate()
-                               && !$this->getUser()->isAllowed( 
'abusefilter-log-private' ) ) {
-                               $searchedForPrivate = false;
-                               foreach( $searchFilters as $index => $filter ) {
-                                       if ( AbuseFilter::filterHidden( $filter 
) ) {
-                                               unset( $searchFilters[$index] );
-                                               $searchedForPrivate = true;
-                                       }
-                               }
-                               if ( $searchedForPrivate ) {
-                                       $out->addWikiMsg( 
'abusefilter-log-private-not-included' );
-                               }
-                       }
                        if ( empty( $searchFilters ) ) {
                                $out->addWikiMsg( 'abusefilter-log-noresults' );
                                return;
@@ -518,9 +504,6 @@
                        );
                        $actionLinks[] = $examineLink;
 
-                       if ($diffLink)
-                               $actionLinks[] = $diffLink;
-
                        if ( $user->isAllowed( 'abusefilter-hide-log' ) ) {
                                $hideLink = Linker::link(
                                        $this->getPageTitle(),
@@ -531,48 +514,40 @@
 
                                $actionLinks[] = $hideLink;
                        }
-
-                       if ( $globalIndex ) {
-                               global $wgAbuseFilterCentralDB;
-                               $globalURL =
-                                       WikiMap::getForeignURL( 
$wgAbuseFilterCentralDB,
-                                                                               
        'Special:AbuseFilter/' . $globalIndex );
-
-                               $linkText = wfMessage( 
'abusefilter-log-detailedentry-global' )->numParams( $globalIndex )->escaped();
-                               $filterLink = Linker::makeExternalLink( 
$globalURL, $linkText );
-                       } else {
-                               $title = SpecialPage::getTitleFor( 
'AbuseFilter', $row->afl_filter );
-                               $linkText = wfMessage( 
'abusefilter-log-detailedentry-local' )->numParams( $row->afl_filter 
)->escaped();
-                               $filterLink = Linker::link( $title, $linkText );
-                       }
-                       $description = $this->msg( 
'abusefilter-log-detailedentry-meta' )->rawParams(
-                               $timestamp,
-                               $userLink,
-                               $filterLink,
-                               $row->afl_action,
-                               $pageLink,
-                               $actions_taken,
-                               $parsed_comments,
-                               $lang->pipeList( $actionLinks ),
-                               $row->afl_user_text
-                       )->parse();
-               } else {
-                       if ( $diffLink ) {
-                               $msg = 'abusefilter-log-entry-withdiff';
-                       } else {
-                               $msg = 'abusefilter-log-entry';
-                       }
-                       $description = $this->msg( $msg )->rawParams(
-                               $timestamp,
-                               $userLink,
-                               $row->afl_action,
-                               $pageLink,
-                               $actions_taken,
-                               $parsed_comments,
-                               $diffLink // Passing $7 to 
'abusefilter-log-entry' will do nothing, as it's not used.
-                       )->parse();
                }
 
+               if ( $diffLink ) {
+                       $actionLinks[] = $diffLink;
+               }
+
+               if ( $globalIndex ) {
+                       global $wgAbuseFilterCentralDB;
+                       $globalURL =
+                               WikiMap::getForeignURL( $wgAbuseFilterCentralDB,
+                                                                               
'Special:AbuseFilter/' . $globalIndex );
+
+                       $linkText = wfMessage( 
'abusefilter-log-detailedentry-global' )->numParams( $globalIndex )->escaped();
+                       $filterLink = Linker::makeExternalLink( $globalURL, 
$linkText );
+               } else {
+                       $title = SpecialPage::getTitleFor( 'AbuseFilter', 
$row->afl_filter );
+                       $linkText = wfMessage( 
'abusefilter-log-detailedentry-local' )->numParams( $row->afl_filter 
)->escaped();
+                       $filterLink = Linker::link( $title, $linkText );
+               }
+
+               $msg = $this->msg( $actionLinks ? 
'abusefilter-log-detailedentry-meta' : 
'abusefilter-log-detailedentry-meta-nolinks' )->rawParams(
+                       $timestamp,
+                       $userLink,
+                       $filterLink,
+                       $row->afl_action,
+                       $pageLink,
+                       $actions_taken,
+                       $parsed_comments
+               );
+               if ( $actionLinks ) {
+                       $msg->rawParams( $lang->pipeList( $actionLinks ) );
+               }
+               $description = $msg->rawParams( $row->afl_user_text )->parse();
+
                if ( self::isHidden( $row ) === true ) {
                        $description .= ' '.
                                $this->msg( 'abusefilter-log-hidden' )->parse();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5076c28245753fcf95fdab1efb09faf4822efe6d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: Jackmcbarn <jackmcb...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to