DeleteAction: Avoid displaying the form unconditionally
Also, turned to override checkCanExecute() in FileDeleteAction instead, to preserve the behaviour before the commit 3e43d318. Bug: T341002 Change-Id: I8faa2ae97373d332d8c126d02d4969565489bf90
This commit is contained in:
parent
a74eaea765
commit
3cdf06b03e
2 changed files with 8 additions and 3 deletions
|
|
@ -122,6 +122,10 @@ class DeleteAction extends FormAction {
|
|||
return $this->msg( 'delete-confirm', $title->getPrefixedText() );
|
||||
}
|
||||
|
||||
public function getRestriction() {
|
||||
return 'delete';
|
||||
}
|
||||
|
||||
protected function alterForm( HTMLForm $form ) {
|
||||
$title = $this->getTitle();
|
||||
$form
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ use MediaWiki\Permissions\PermissionStatus;
|
|||
use MediaWiki\Title\Title;
|
||||
use OldLocalFile;
|
||||
use PermissionsError;
|
||||
use User;
|
||||
|
||||
/**
|
||||
* Handle file deletion
|
||||
|
|
@ -208,12 +209,12 @@ class FileDeleteAction extends DeleteAction {
|
|||
return $this->getTitle()->getLocalURL( $q );
|
||||
}
|
||||
|
||||
public function getRestriction() {
|
||||
protected function checkCanExecute( User $user ) {
|
||||
parent::checkCanExecute( $user );
|
||||
|
||||
if ( $this->getContext()->getConfig()->get( MainConfigNames::UploadMaintenance ) ) {
|
||||
throw new ErrorPageError( 'filedelete-maintenance-title', 'filedelete-maintenance' );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue