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": [
"spamblacklistlog"
"spamblacklistlog",
"sboverride"
],
"LogTypes": [
"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-signup": "The given email address is currently forbidden from use.",
"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-blacklist-desc": "Regex-based anti-spam tool allowing to forbid URLs in pages and email addresses for registered users",
"log-name-spamblacklist": "Spam block list log",
"log-description-spamblacklist": "These events track spam block list hits.",
"logentry-spamblacklist-hit": "{{GENDER:$2|$1}} caused a spam block list hit on $3 by attempting to add $4.",
"right-spamblacklistlog": "View the spam block list log",
"action-spamblacklistlog": "view the spam block list log"
"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 blacklist URLs in pages and email addresses for registered users",
"log-name-spamblacklist": "Spam blacklist log",
"log-description-spamblacklist": "These events track spam blacklist hits.",
"logentry-spamblacklist-hit": "{{GENDER:$2|$1}} caused a spam blacklist hit on $3 by attempting to add $4.",
"right-spamblacklistlog": "View the spam blacklist 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",
"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}}",
"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,
$minoredit
) {
if ( MediaWikiServices::getInstance()->getPermissionManager()
->userHasRight( $user, 'sboverride' )
) {
return true;
}
$title = $context->getTitle();
try {
// Try getting the update directly
@ -251,6 +257,12 @@ class Hooks implements
$pageText,
&$error
) {
if ( MediaWikiServices::getInstance()->getPermissionManager()
->userHasRight( $user, 'sboverride' )
) {
return;
}
$title = $upload->getTitle();
// get the link from the not-yet-saved page content.