Matěj Suchánek has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/373505 )
Change subject: Filter AbuseLog by the "impact" of the change ...................................................................... Filter AbuseLog by the "impact" of the change Users can choose whether they want to see entries that changed the wiki or didn't (or they can apply no filter). Bug: T159061 Change-Id: I6cee9b001c26c4bbc837131781deef27d5e3ef1a --- M i18n/en.json M i18n/qqq.json M includes/special/SpecialAbuseLog.php 3 files changed, 35 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter refs/changes/05/373505/1 diff --git a/i18n/en.json b/i18n/en.json index 649fc3e..239eb02 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -47,6 +47,10 @@ "abusefilter-log-search-filter": "Filter IDs (separate with pipes):", "abusefilter-log-search-title": "Title:", "abusefilter-log-search-wiki": "Wiki:", + "abusefilter-log-search-impact": "Impact:", + "abusefilter-log-search-impact-all": "All actions", + "abusefilter-log-search-impact-saved": "Saved changes only", + "abusefilter-log-search-impact-not-saved": "Without saved changes", "abusefilter-log-search-entries-label": "Visibility:", "abusefilter-log-search-entries-all": "All entries", "abusefilter-log-search-entries-hidden": "Hidden entries only", diff --git a/i18n/qqq.json b/i18n/qqq.json index a7aff88..a446f5b 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -78,6 +78,10 @@ "abusefilter-log-search-filter": "Field label in abuse filter log page.", "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-impact": "Label for options allowing to filter abuse log by whether the action was actually saved.", + "abusefilter-log-search-impact-all": "Option allowing to find all actions in abuse log.", + "abusefilter-log-search-impact-saved": "Option allowing to find saved changes only in abuse log.", + "abusefilter-log-search-impact-not-saved": "Option allowing to filter saved changes out from abuse log.", "abusefilter-log-search-entries-label": "Label for options allowing to find entries with specified visibility.\n{{Identical|Visibility}}", "abusefilter-log-search-entries-all": "Option allowing to find all entries in abuse log.", "abusefilter-log-search-entries-hidden": "Option allowing to find hidden entries only in abuse log.", diff --git a/includes/special/SpecialAbuseLog.php b/includes/special/SpecialAbuseLog.php index bac89fe..4097dae 100644 --- a/includes/special/SpecialAbuseLog.php +++ b/includes/special/SpecialAbuseLog.php @@ -17,6 +17,8 @@ protected $mSearchEntries; + protected $mSearchImpact; + public function __construct() { parent::__construct( 'AbuseLog', 'abusefilter-log' ); } @@ -99,6 +101,7 @@ } $this->mSearchEntries = $request->getText( 'wpSearchEntries' ); + $this->mSearchImpact = $request->getText( 'wpSearchImpact' ); } function searchForm() { @@ -114,7 +117,16 @@ 'label-message' => 'abusefilter-log-search-title', 'type' => 'title', 'default' => $this->mSearchTitle, - ] + ], + 'SearchImpact' => [ + 'label-message' => 'abusefilter-log-search-impact', + 'type' => 'select', + 'options' => [ + $this->msg( 'abusefilter-log-search-impact-all' )->text() => 0, + $this->msg( 'abusefilter-log-search-impact-saved' )->text() => 1, + $this->msg( 'abusefilter-log-search-impact-not-saved' )->text() => 2, + ], + ], ]; if ( self::canSeeDetails() ) { $formDescriptor['SearchFilter'] = [ @@ -286,11 +298,24 @@ $conds['afl_title'] = $searchTitle->getDBkey(); } + $dbr = wfGetDB( DB_SLAVE ); if ( self::canSeeHidden() ) { if ( $this->mSearchEntries == '1' ) { $conds['afl_deleted'] = 1; } elseif ( $this->mSearchEntries == '2' ) { - $conds[] = self::getNotDeletedCond( wfGetDB( DB_SLAVE ) ); + $conds[] = self::getNotDeletedCond( $dbr ); + } + } + + if ( in_array( $this->mSearchImpact, [ '1', '2' ] ) ) { + $unsuccessfulActionConds = $dbr->makeList( [ + 'afl_rev_id' => null, + 'afl_log_id' => null, + ], LIST_AND ); + if ( $this->mSearchImpact == '1' ) { + $conds[] = "NOT ( $unsuccessfulActionConds )"; + } else { + $conds[] = $unsuccessfulActionConds; } } -- To view, visit https://gerrit.wikimedia.org/r/373505 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6cee9b001c26c4bbc837131781deef27d5e3ef1a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AbuseFilter Gerrit-Branch: master Gerrit-Owner: Matěj Suchánek <matejsuchane...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits