Split reason dropdown list for action=delete
Reasons for oversighter should only used by them, so allow them to be added to the end of the list if the user is allowed. There is no extra separator between both lists, because the reason list can be structured by */** Done for page deletion and file deletion Similar to I7cb8bc17a297285da83b3b4c664b634fe0db660c Bug: T250631 Change-Id: I854a390c9abf8bb78fec520cd59b41ba6b7513b5
This commit is contained in:
parent
3b3027a6e1
commit
91a95e56bd
4 changed files with 52 additions and 8 deletions
|
|
@ -304,8 +304,16 @@ class FileDeleteForm {
|
|||
$this->prepareMessage( 'filedelete-intro' ) ) ]
|
||||
);
|
||||
|
||||
$suppressAllowed = $permissionManager->userHasRight( $this->user, 'suppressrevision' );
|
||||
$dropDownReason = $wgOut->msg( 'filedelete-reason-dropdown' )->inContentLanguage()->text();
|
||||
// Add additional specific reasons for suppress
|
||||
if ( $suppressAllowed ) {
|
||||
$dropDownReason .= "\n" . $wgOut->msg( 'filedelete-reason-dropdown-suppress' )
|
||||
->inContentLanguage()->text();
|
||||
}
|
||||
|
||||
$options = Xml::listDropDownOptions(
|
||||
$wgOut->msg( 'filedelete-reason-dropdown' )->inContentLanguage()->text(),
|
||||
$dropDownReason,
|
||||
[ 'other' => $wgOut->msg( 'filedelete-reason-otherlist' )->inContentLanguage()->text() ]
|
||||
);
|
||||
$options = Xml::listDropDownOptionsOoui( $options );
|
||||
|
|
@ -344,7 +352,7 @@ class FileDeleteForm {
|
|||
]
|
||||
);
|
||||
|
||||
if ( $permissionManager->userHasRight( $this->user, 'suppressrevision' ) ) {
|
||||
if ( $suppressAllowed ) {
|
||||
$fields[] = new OOUI\FieldLayout(
|
||||
new OOUI\CheckboxInputWidget( [
|
||||
'name' => 'wpSuppress',
|
||||
|
|
@ -419,10 +427,20 @@ class FileDeleteForm {
|
|||
);
|
||||
|
||||
if ( $permissionManager->userHasRight( $this->user, 'editinterface' ) ) {
|
||||
$link = '';
|
||||
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
|
||||
$link = $linkRenderer->makeKnownLink(
|
||||
if ( $suppressAllowed ) {
|
||||
$link .= $linkRenderer->makeKnownLink(
|
||||
$wgOut->msg( 'filedelete-reason-dropdown-suppress' )->inContentLanguage()->getTitle(),
|
||||
$wgOut->msg( 'filedelete-edit-reasonlist-suppress' )->text(),
|
||||
[],
|
||||
[ 'action' => 'edit' ]
|
||||
);
|
||||
$link .= $wgOut->msg( 'pipe-separator' )->escaped();
|
||||
}
|
||||
$link .= $linkRenderer->makeKnownLink(
|
||||
$wgOut->msg( 'filedelete-reason-dropdown' )->inContentLanguage()->getTitle(),
|
||||
wfMessage( 'filedelete-edit-reasonlist' )->text(),
|
||||
$wgOut->msg( 'filedelete-edit-reasonlist' )->text(),
|
||||
[],
|
||||
[ 'action' => 'edit' ]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2000,8 +2000,16 @@ class Article implements Page {
|
|||
|
||||
$fields = [];
|
||||
|
||||
$suppressAllowed = $this->permManager->userHasRight( $user, 'suppressrevision' );
|
||||
$dropDownReason = $ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->text();
|
||||
// Add additional specific reasons for suppress
|
||||
if ( $suppressAllowed ) {
|
||||
$dropDownReason .= "\n" . $ctx->msg( 'deletereason-dropdown-suppress' )
|
||||
->inContentLanguage()->text();
|
||||
}
|
||||
|
||||
$options = Xml::listDropDownOptions(
|
||||
$ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->text(),
|
||||
$dropDownReason,
|
||||
[ 'other' => $ctx->msg( 'deletereasonotherlist' )->inContentLanguage()->text() ]
|
||||
);
|
||||
$options = Xml::listDropDownOptionsOoui( $options );
|
||||
|
|
@ -2055,7 +2063,7 @@ class Article implements Page {
|
|||
]
|
||||
);
|
||||
}
|
||||
if ( $this->permManager->userHasRight( $user, 'suppressrevision' ) ) {
|
||||
if ( $suppressAllowed ) {
|
||||
$fields[] = new OOUI\FieldLayout(
|
||||
new OOUI\CheckboxInputWidget( [
|
||||
'name' => 'wpSuppress',
|
||||
|
|
@ -2114,9 +2122,19 @@ class Article implements Page {
|
|||
);
|
||||
|
||||
if ( $this->permManager->userHasRight( $user, 'editinterface' ) ) {
|
||||
$link = $this->linkRenderer->makeKnownLink(
|
||||
$link = '';
|
||||
if ( $suppressAllowed ) {
|
||||
$link .= $this->linkRenderer->makeKnownLink(
|
||||
$ctx->msg( 'deletereason-dropdown-suppress' )->inContentLanguage()->getTitle(),
|
||||
$ctx->msg( 'delete-edit-reasonlist-suppress' )->text(),
|
||||
[],
|
||||
[ 'action' => 'edit' ]
|
||||
);
|
||||
$link .= $ctx->msg( 'pipe-separator' )->escaped();
|
||||
}
|
||||
$link .= $this->linkRenderer->makeKnownLink(
|
||||
$ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->getTitle(),
|
||||
wfMessage( 'delete-edit-reasonlist' )->text(),
|
||||
$ctx->msg( 'delete-edit-reasonlist' )->text(),
|
||||
[],
|
||||
[ 'action' => 'edit' ]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1981,7 +1981,9 @@
|
|||
"filedelete-otherreason": "Other/additional reason:",
|
||||
"filedelete-reason-otherlist": "Other reason",
|
||||
"filedelete-reason-dropdown": "*Common delete reasons\n** Copyright violation\n** Duplicated file",
|
||||
"filedelete-reason-dropdown-suppress": "",
|
||||
"filedelete-edit-reasonlist": "Edit delete reasons",
|
||||
"filedelete-edit-reasonlist-suppress": "Edit suppress reasons",
|
||||
"filedelete-maintenance": "Deletion and restoration of files temporarily disabled during maintenance.",
|
||||
"filedelete-maintenance-title": "Cannot delete file",
|
||||
"mimesearch": "MIME search",
|
||||
|
|
@ -2449,7 +2451,9 @@
|
|||
"deleteotherreason": "Other/additional reason:",
|
||||
"deletereasonotherlist": "Other reason",
|
||||
"deletereason-dropdown": "* Common delete reasons\n** Spam\n** Vandalism\n** Copyright violation\n** Author request\n** Broken redirect",
|
||||
"deletereason-dropdown-suppress": "",
|
||||
"delete-edit-reasonlist": "Edit deletion reasons",
|
||||
"delete-edit-reasonlist-suppress": "Edit suppress reasons",
|
||||
"delete-toobig": "This page has a large edit history, over $1 {{PLURAL:$1|revision|revisions}}.\nDeletion of such pages has been restricted to prevent accidental disruption of {{SITENAME}}.",
|
||||
"delete-warning-toobig": "This page has a large edit history, over $1 {{PLURAL:$1|revision|revisions}}.\nDeleting it may disrupt database operations of {{SITENAME}};\nproceed with caution.",
|
||||
"deleteprotected": "You cannot delete this page because it has been protected.",
|
||||
|
|
|
|||
|
|
@ -2197,7 +2197,9 @@
|
|||
"filedelete-otherreason": "Message used when deleting a file. This is the description field for \"Other/additional reason\" for deletion.\n\n{{Identical|Other/additional reason}}",
|
||||
"filedelete-reason-otherlist": "Message used as default in the dropdown menu in the form for deleting a file. Keeping this message selected assumes that a reason for deletion is specified in the field below.\n\n{{Identical|Other reason}}",
|
||||
"filedelete-reason-dropdown": "Predefined reasons for deleting a file that can be selected in a drop down list. Entries prefixed with one asterisk (\"*\") are group headers and cannot be selected. Entries prefixed with two asterisks can be selected as reason for deletion.",
|
||||
"filedelete-reason-dropdown-suppress": "Predefined reasons for suppressing a file that can be selected in a drop down list. Entries prefixed with one asterisk (\"*\") are group headers and cannot be selected. Entries prefixed with two asterisks can be selected as reason for deletion.",
|
||||
"filedelete-edit-reasonlist": "Shown beneath the file deletion form on the right side. It is a link to [[MediaWiki:Filedelete-reason-dropdown]].\n\n{{Identical|Edit delete reasons}}",
|
||||
"filedelete-edit-reasonlist-suppress": "Shown beneath the file deletion form on the right side. It is a link to [[MediaWiki:Filedelete-reason-dropdown-suppress]].\n\n{{Identical|Edit delete reasons}}",
|
||||
"filedelete-maintenance": "Content of the error page when $wgUploadMaintenance is set to true.",
|
||||
"filedelete-maintenance-title": "Title of the error page when $wgUploadMaintenance is set to true.",
|
||||
"mimesearch": "Used as page title for [[Special:MIMESearch]], legend of input form and link text in [[Special:SpecialPages]].\n\nStrings on the page:\n* {{msg-mw|Mimesearch|page title, legend of input form, link in special pages}}\n* {{msg-mw|Mimesearch-summary|page summary}}\n* {{msg-mw|Mimetype|label for input box}}\n* {{msg-mw|Ilsubmit|search button}}\n\nCheck [[mw:Manual:MIME_type_detection]] for MIME types.",
|
||||
|
|
@ -2665,7 +2667,9 @@
|
|||
"deleteotherreason": "{{Identical|Other/additional reason}}",
|
||||
"deletereasonotherlist": "{{Identical|Other reason}}",
|
||||
"deletereason-dropdown": "Default reasons for deletion. Displayed as a drop-down list. Format:\n<pre>* Group\n** Common delete reason\n** ...</pre>",
|
||||
"deletereason-dropdown-suppress": "Default reasons for suppression. Displayed as a drop-down list. Format:\n<pre>* Group\n** Common delete reason\n** ...</pre>",
|
||||
"delete-edit-reasonlist": "Shown beneath the page deletion form on the right side. It is a link to {{msg-mw|Deletereason-dropdown|notext=1}}.\n\nSee also:\n* {{msg-mw|Ipb-edit-dropdown}}\n* {{msg-mw|Protect-edit-reasonlist}}.\n{{Identical|Edit delete reasons}}",
|
||||
"delete-edit-reasonlist-suppress": "Shown beneath the page deletion form on the right side. It is a link to {{msg-mw|Deletereason-dropdown-suppress|notext=1}}.\n\nSee also:\n* {{msg-mw|Ipb-edit-dropdown}}\n* {{msg-mw|Protect-edit-reasonlist}}.\n{{Identical|Edit delete reasons}}",
|
||||
"delete-toobig": "Parameters:\n* $1 - the upper limit of number of revisions\nSee also:\n* {{msg-mw|Delete-warning-toobig}}",
|
||||
"delete-warning-toobig": "Parameters:\n* $1 - the upper limit of number of revisions\nSee also:\n* {{msg-mw|Delete-toobig}}",
|
||||
"deleteprotected": "Used as error message when deleting the page.\n\n\"If protection keeps them from editing, they shouldn't be able to delete.\"",
|
||||
|
|
|
|||
Loading…
Reference in a new issue