Special:AbuseFilter page title should mention filter name

- Mentions filter number and name in the title
- Distinguishes between viewing and editing

Bug: T353106
Change-Id: Idda9854a78937033b168603810154b48288c3f4c
This commit is contained in:
Novem Linguae 2023-12-10 05:14:27 -08:00
parent 9df0825cd1
commit 88e9d8d0b6
3 changed files with 24 additions and 4 deletions

View file

@ -186,7 +186,10 @@
"abusefilter-reautoconfirm-notallowed": "You are not allowed to restore autoconfirmed status.",
"abusefilter-reautoconfirm-done": "Account's autoconfirmed status has been restored",
"abusefilter-status": "Of the last $1 {{PLURAL:$1|action|actions}}, $2 ($3%) {{PLURAL:$2|has|have}} reached the condition limit of $4, and $5 ($6%) {{PLURAL:$5|has|have}} matched at least one of the filters currently enabled.",
"abusefilter-add": "Adding abuse filter",
"abusefilter-edit": "Editing abuse filter",
"abusefilter-edit-specific": "Editing abuse filter $1: $2",
"abusefilter-view-specific": "Viewing abuse filter $1: $2",
"abusefilter-edit-subtitle": "Editing filter $1",
"abusefilter-edit-subtitle-new": "Creating filter",
"abusefilter-edit-token-not-match": "The edit wasn't saved! Please save again.",

View file

@ -230,7 +230,10 @@
"abusefilter-reautoconfirm-notallowed": "Error text when trying to perform an action the user cannot perform. See {{msg-mw|group-autoconfirmed}} for concept translation.",
"abusefilter-reautoconfirm-done": "See {{msg-mw|group-autoconfirmed}} for concept translation.\n* $1 is the target username (optional, used for GENDER).",
"abusefilter-status": "Status information displayed on top of [[Special:AbuseFilter]]. Parameters:\n* $1 is the number of recent actions\n* $2 is the number of filter runs that reached the limit of $4 conditions (and have had to be terminated)\n* $3 is a percentage: $2 / $1 * 100\n* $4 is the maximum number of conditions allowed\n* $5 is the number of matched actions\n* $6 is a percentage: $5 / $1 * 100",
"abusefilter-edit": "Page title when editing an abuse filter.",
"abusefilter-add": "Page title when creating an abuse filter.",
"abusefilter-edit": "Page title when editing an abuse filter. Is mainly shown in error messages.",
"abusefilter-edit-specific": "Page title when editing an abuse filter. $1 is the abuse filter number. $2 is the abuse filter name.",
"abusefilter-view-specific": "Page title when viewing an abuse filter. $1 is the abuse filter number. $2 is the abuse filter name.",
"abusefilter-edit-subtitle": "Page subtitle when editing an abuse filter. Parameters:\n* $1 - filter ID\n* $2 - (Unused) history ID\nSee also:\n* {{msg-mw|Abusefilter-edit-subtitle-new}} - if the filter ID is \"new\".",
"abusefilter-edit-subtitle-new": "Page subtitle when creating an abuse filter. Parameters:\n* $1 - (Unused) filter ID\n* $2 - (Unused) history ID\nSee also:\n* {{msg-mw|Abusefilter-edit-subtitle}} - if editing the existing filter",
"abusefilter-edit-token-not-match": "Warning displayed when saving the filter didn't succeed.",

View file

@ -279,9 +279,10 @@ class AbuseFilterViewEdit extends AbuseFilterView {
$user = $this->getUser();
$actions = $filterObj->getActions();
$isCreatingNewFilter = $filter === null;
$out->addSubtitle( $this->msg(
$filter === null ? 'abusefilter-edit-subtitle-new' : 'abusefilter-edit-subtitle',
$filter === null ? $filter : $this->getLanguage()->formatNum( $filter ),
$isCreatingNewFilter ? 'abusefilter-edit-subtitle-new' : 'abusefilter-edit-subtitle',
$isCreatingNewFilter ? $filter : $this->getLanguage()->formatNum( $filter ),
$history_id
)->parse() );
@ -296,6 +297,19 @@ class AbuseFilterViewEdit extends AbuseFilterView {
return;
}
if ( $isCreatingNewFilter ) {
$title = $this->msg( 'abusefilter-add' );
} elseif ( $this->afPermManager->canEditFilter( $user, $filterObj ) ) {
$title = $this->msg( 'abusefilter-edit-specific' )
->numParams( $this->filter )
->params( $filterObj->getName() );
} else {
$title = $this->msg( 'abusefilter-view-specific' )
->numParams( $this->filter )
->params( $filterObj->getName() );
}
$out->setPageTitleMsg( $title );
$readOnly = !$this->afPermManager->canEditFilter( $user, $filterObj );
if ( $history_id ) {
@ -312,7 +326,7 @@ class AbuseFilterViewEdit extends AbuseFilterView {
$fields = [];
$fields['abusefilter-edit-id'] =
$filter === null ?
$isCreatingNewFilter ?
$this->msg( 'abusefilter-edit-new' )->escaped() :
htmlspecialchars( $lang->formatNum( (string)$filter ) );
$fields['abusefilter-edit-description'] =