mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 00:00:49 +00:00
ApiVisualEditorEdit: Simplify diff handling a bit
I'm trying to track down possible values of 'result' for client-side error handling and this was confusing. Change-Id: I325249f7c57936c9c11a1d3dc9166b1ca3737c39
This commit is contained in:
parent
99cd4e26e9
commit
1e890f975f
|
@ -353,7 +353,7 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
|
|||
] );
|
||||
|
||||
if ( !isset( $result['compare']['*'] ) ) {
|
||||
return [ 'result' => 'fail' ];
|
||||
$this->dieWithError( 'apierror-visualeditor-difffailed', 'difffailed' );
|
||||
}
|
||||
$diffRows = $result['compare']['*'];
|
||||
|
||||
|
@ -408,11 +408,7 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
|
|||
$result = [ 'result' => 'success', 'cachekey' => $key ];
|
||||
} elseif ( $params['paction'] === 'diff' ) {
|
||||
$section = $params['section'] ?? null;
|
||||
$diff = $this->diffWikitext( $title, $params['oldid'], $wikitext, $section );
|
||||
if ( $diff['result'] === 'fail' ) {
|
||||
$this->dieWithError( 'apierror-visualeditor-difffailed', 'difffailed' );
|
||||
}
|
||||
$result = $diff;
|
||||
$result = $this->diffWikitext( $title, $params['oldid'], $wikitext, $section );
|
||||
} elseif ( $params['paction'] === 'save' ) {
|
||||
$saveresult = $this->saveWikitext( $title, $wikitext, $params );
|
||||
$editStatus = $saveresult['edit']['result'];
|
||||
|
|
Loading…
Reference in a new issue