mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Show AF logs for a revdeled revision if the user can see the revision
The function used to determine if a row is hidden has three possible return values: true, false and "implicit". While the first and the second one refer to AF own suppressing system, 'implicit' means that the revision associated with the log entry is deleted. However, we checked for such return value with a boolean cast, which caused true and 'implicit' to be equally treated, thus hiding revdel'ed revisions to sysops. Bonus: fixed a comment typo. Bug: T191699 Change-Id: I87d3a6437bb966198175e4bfd063e30ed79c345f
This commit is contained in:
parent
0862148509
commit
0e87c44c74
|
@ -85,6 +85,7 @@
|
|||
"abusefilter-log-cannot-see-private-details": "You do not have permission to see private details of this entry.",
|
||||
"abusefilter-log-nonexistent": "An entry with the provided ID does not exist.",
|
||||
"abusefilter-log-details-hidden": "You cannot view the details for this entry because it is hidden from public view.",
|
||||
"abusefilter-log-details-hidden-implicit": "You cannot view the details for this entry because its associated revision is hidden from public view.",
|
||||
"abusefilter-log-private-not-included": "One or more of the filter IDs you specified are private. Because you are not allowed to view details of private filters, these filters have not been searched for.",
|
||||
"abusefilter-log-hide-legend": "Hide log entry",
|
||||
"abusefilter-log-hide-id": "Log entry ID:",
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
"abusefilter-log-cannot-see-private-details": "Message shown instead of log row private details for users without permissions to see them.",
|
||||
"abusefilter-log-nonexistent": "Message shown instead of log row details when the provided log ID does not exist.",
|
||||
"abusefilter-log-details-hidden": "Message shown instead of log row details when those are hidden.",
|
||||
"abusefilter-log-details-hidden-implicit": "Message shown instead of log row details when their associated revision is hidden.",
|
||||
"abusefilter-log-private-not-included": "Message shown when an unauthorized user searches by ID for private filters.",
|
||||
"abusefilter-log-hide-legend": "Legend for form to hide a log entry.",
|
||||
"abusefilter-log-hide-id": "Field label in form to hide a log entry.",
|
||||
|
|
|
@ -1461,7 +1461,7 @@ class AbuseFilter {
|
|||
* @return array|object|AbuseFilterVariableHolder|bool
|
||||
*/
|
||||
public static function loadVarDump( $stored_dump ) {
|
||||
// Back-compact
|
||||
// Backward compatibility
|
||||
if ( substr( $stored_dump, 0, strlen( 'stored-text:' ) ) !== 'stored-text:' ) {
|
||||
$data = unserialize( $stored_dump );
|
||||
if ( is_array( $data ) ) {
|
||||
|
|
|
@ -128,7 +128,12 @@ class AbuseFilterViewExamine extends AbuseFilterView {
|
|||
$dbr = wfGetDB( DB_REPLICA );
|
||||
$row = $dbr->selectRow(
|
||||
'abuse_filter_log',
|
||||
[ 'afl_filter', 'afl_deleted', 'afl_var_dump' ],
|
||||
[
|
||||
'afl_filter',
|
||||
'afl_deleted',
|
||||
'afl_var_dump',
|
||||
'afl_rev_id'
|
||||
],
|
||||
[ 'afl_id' => $logid ],
|
||||
__METHOD__
|
||||
);
|
||||
|
@ -152,6 +157,10 @@ class AbuseFilterViewExamine extends AbuseFilterView {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( SpecialAbuseLog::isHidden( $row ) && !$this->getUser()->isAllowed( 'deletedtext' ) ) {
|
||||
$out->addWikiMsg( 'abusefilter-log-details-hidden-implicit' );
|
||||
return;
|
||||
}
|
||||
$vars = AbuseFilter::loadVarDump( $row->afl_var_dump );
|
||||
$out->addJsConfigVars( 'wgAbuseFilterVariables', $vars->dumpAllVars( true ) );
|
||||
$this->showExaminer( $vars );
|
||||
|
|
|
@ -85,7 +85,6 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
$errors = $this->getPageTitle()->getUserPermissionsErrors(
|
||||
'abusefilter-log', $this->getUser(), true, [ 'ns-specialprotected' ] );
|
||||
if ( count( $errors ) ) {
|
||||
// Go away.
|
||||
$out->showPermissionsErrorPage( $errors, 'abusefilter-log' );
|
||||
|
||||
return;
|
||||
|
@ -489,9 +488,14 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( self::isHidden( $row ) && !self::canSeeHidden() ) {
|
||||
if ( self::isHidden( $row ) === true && !self::canSeeHidden() ) {
|
||||
$out->addWikiMsg( 'abusefilter-log-details-hidden' );
|
||||
|
||||
return;
|
||||
} elseif ( self::isHidden( $row ) === 'implicit' &&
|
||||
!$this->getUser()->isAllowed( 'deletedtext' ) ) {
|
||||
// The log is visible, but refers to a deleted revision
|
||||
$out->addWikiMsg( 'abusefilter-log-details-hidden-implicit' );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -858,7 +862,7 @@ class SpecialAbuseLog extends SpecialPage {
|
|||
$diffLink = false;
|
||||
$isHidden = self::isHidden( $row );
|
||||
|
||||
if ( !self::canSeeHidden() && $isHidden ) {
|
||||
if ( !self::canSeeHidden() && $isHidden === true ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue