Merge "Show all error messages on unsuccessful rollback"
This commit is contained in:
commit
332b97c9dd
1 changed files with 15 additions and 17 deletions
|
|
@ -191,13 +191,22 @@ class RollbackAction extends FormAction {
|
|||
throw new ThrottledError;
|
||||
}
|
||||
|
||||
if ( $rollbackResult->hasMessage( 'alreadyrolled' ) || $rollbackResult->hasMessage( 'cantrollback' ) ) {
|
||||
$this->getOutput()->setPageTitleMsg( $this->msg( 'rollbackfailed' ) );
|
||||
# XXX: Why are we only showing the first error message, instead of all of them?
|
||||
$msg = $rollbackResult->getMessages()[0];
|
||||
$this->getOutput()->addWikiMsg( $msg );
|
||||
# NOTE: Permission errors already handled by Action::checkExecute.
|
||||
if ( $rollbackResult->hasMessage( 'readonlytext' ) ) {
|
||||
throw new ReadOnlyError;
|
||||
}
|
||||
|
||||
if ( isset( $data['current-revision-record'] ) ) {
|
||||
if ( $rollbackResult->getMessages() ) {
|
||||
$this->getOutput()->setPageTitleMsg( $this->msg( 'rollbackfailed' ) );
|
||||
|
||||
foreach ( $rollbackResult->getMessages() as $msg ) {
|
||||
$this->getOutput()->addWikiMsg( $msg );
|
||||
}
|
||||
|
||||
if (
|
||||
( $rollbackResult->hasMessage( 'alreadyrolled' ) || $rollbackResult->hasMessage( 'cantrollback' ) )
|
||||
&& isset( $data['current-revision-record'] )
|
||||
) {
|
||||
/** @var RevisionRecord $current */
|
||||
$current = $data['current-revision-record'];
|
||||
|
||||
|
|
@ -215,17 +224,6 @@ class RollbackAction extends FormAction {
|
|||
return;
|
||||
}
|
||||
|
||||
# NOTE: Permission errors already handled by Action::checkExecute.
|
||||
if ( $rollbackResult->hasMessage( 'readonlytext' ) ) {
|
||||
throw new ReadOnlyError;
|
||||
}
|
||||
|
||||
# XXX: Would be nice if ErrorPageError could take multiple errors, and/or a status object.
|
||||
# Right now, we only show the first error
|
||||
foreach ( $rollbackResult->getMessages() as $msg ) {
|
||||
throw new ErrorPageError( 'rollbackfailed', $msg );
|
||||
}
|
||||
|
||||
/** @var RevisionRecord $current */
|
||||
$current = $data['current-revision-record'];
|
||||
$target = $data['target-revision-record'];
|
||||
|
|
|
|||
Loading…
Reference in a new issue