Merge "Add sboverride right to override the spam blacklist"

This commit is contained in:
jenkins-bot 2022-07-14 05:26:38 +00:00 committed by Gerrit Code Review
commit c0216339ea
4 changed files with 26 additions and 9 deletions

View file

@ -18,7 +18,8 @@
} }
}, },
"AvailableRights": [ "AvailableRights": [
"spamblacklistlog" "spamblacklistlog",
"sboverride"
], ],
"LogTypes": [ "LogTypes": [
"spamblacklist" "spamblacklist"

View file

@ -10,11 +10,13 @@
"spam-blacklisted-email-text": "Your email address is currently forbidden from sending emails to other users.", "spam-blacklisted-email-text": "Your email address is currently forbidden from sending emails to other users.",
"spam-blacklisted-email-signup": "The given email address is currently forbidden from use.", "spam-blacklisted-email-signup": "The given email address is currently forbidden from use.",
"spam-blacklisted-link": "{{int:spamprotectiontext}}\n{{int:spamprotectionmatch|$1}}", "spam-blacklisted-link": "{{int:spamprotectiontext}}\n{{int:spamprotectionmatch|$1}}",
"spam-invalid-lines": "The following spam block list {{PLURAL:$1|line is an|lines are}} invalid regular {{PLURAL:$1|expression|expressions}} and {{PLURAL:$1|needs|need}} to be corrected before saving the page:", "spam-invalid-lines": "The following spam blacklist {{PLURAL:$1|line is an|lines are}} invalid regular {{PLURAL:$1|expression|expressions}} and {{PLURAL:$1|needs|need}} to be corrected before saving the page:",
"spam-blacklist-desc": "Regex-based anti-spam tool allowing to forbid URLs in pages and email addresses for registered users", "spam-blacklist-desc": "Regex-based anti-spam tool allowing to blacklist URLs in pages and email addresses for registered users",
"log-name-spamblacklist": "Spam block list log", "log-name-spamblacklist": "Spam blacklist log",
"log-description-spamblacklist": "These events track spam block list hits.", "log-description-spamblacklist": "These events track spam blacklist hits.",
"logentry-spamblacklist-hit": "{{GENDER:$2|$1}} caused a spam block list hit on $3 by attempting to add $4.", "logentry-spamblacklist-hit": "{{GENDER:$2|$1}} caused a spam blacklist hit on $3 by attempting to add $4.",
"right-spamblacklistlog": "View the spam block list log", "right-spamblacklistlog": "View the spam blacklist log",
"action-spamblacklistlog": "view the spam block list log" "action-spamblacklistlog": "view the spam blacklist log",
"right-sboverride": "Bypass the spam blacklist",
"action-sboverride": "Bypass the spam blacklist"
} }

View file

@ -24,5 +24,7 @@
"log-description-spamblacklist": "Description of spam blacklist log", "log-description-spamblacklist": "Description of spam blacklist log",
"logentry-spamblacklist-hit": "Log entry that is created when a user adds a link that is forbidden by the spam blacklist.\n\n{{logentry}}\nAdditional parameters:\n* $4 - the URL the user tried to add", "logentry-spamblacklist-hit": "Log entry that is created when a user adds a link that is forbidden by the spam blacklist.\n\n{{logentry}}\nAdditional parameters:\n* $4 - the URL the user tried to add",
"right-spamblacklistlog": "{{doc-right|spamblacklistlog}}", "right-spamblacklistlog": "{{doc-right|spamblacklistlog}}",
"action-spamblacklistlog": "{{doc-action|spamblacklistlog}}" "action-spamblacklistlog": "{{doc-action|spamblacklistlog}}",
"right-sboverride": "{{doc-right|sboverride}}",
"action-sboverride": "{{doc-action|sboverride}}"
} }

View file

@ -61,6 +61,12 @@ class Hooks implements
User $user, User $user,
$minoredit $minoredit
) { ) {
if ( MediaWikiServices::getInstance()->getPermissionManager()
->userHasRight( $user, 'sboverride' )
) {
return true;
}
$title = $context->getTitle(); $title = $context->getTitle();
try { try {
// Try getting the update directly // Try getting the update directly
@ -251,6 +257,12 @@ class Hooks implements
$pageText, $pageText,
&$error &$error
) { ) {
if ( MediaWikiServices::getInstance()->getPermissionManager()
->userHasRight( $user, 'sboverride' )
) {
return;
}
$title = $upload->getTitle(); $title = $upload->getTitle();
// get the link from the not-yet-saved page content. // get the link from the not-yet-saved page content.