ApiVisualEditorEdit: Remove unnecessary check

There are no occurrences of the error message in our error logging
data, so it most likely can never happen.

https://superset.wikimedia.org/superset/sqllab/
```
select count(*)
from editattemptstep
where event.save_failure_message = 'visualeditor-docserver'
```

Change-Id: I8172564057418283468c657cbc6d42ce8ddb35f4
This commit is contained in:
Bartosz Dziewoński 2023-06-02 23:23:06 +02:00 committed by Bartosz Dziewoński
parent fbd33d63ee
commit 8573df0233
2 changed files with 1 additions and 19 deletions

View file

@ -195,7 +195,6 @@
"class": "MediaWiki\\Extension\\VisualEditor\\ApiVisualEditorEdit",
"services": [
"VisualEditorHookRunner",
"RevisionLookup",
"StatsdDataFactory",
"PageEditStash",
"SkinFactory",

View file

@ -23,7 +23,6 @@ use FlaggablePageView;
use IBufferingStatsdDataFactory;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\Page\WikiPageFactory;
use MediaWiki\Revision\RevisionLookup;
use MediaWiki\Storage\PageEditStash;
use MediaWiki\User\UserIdentity;
use ObjectCache;
@ -40,7 +39,6 @@ class ApiVisualEditorEdit extends ApiBase {
private const MAX_CACHE_TTL = 900;
private VisualEditorHookRunner $hookRunner;
private RevisionLookup $revisionLookup;
private PageEditStash $pageEditStash;
private SkinFactory $skinFactory;
private WikiPageFactory $wikiPageFactory;
@ -50,7 +48,6 @@ class ApiVisualEditorEdit extends ApiBase {
ApiMain $main,
string $name,
VisualEditorHookRunner $hookRunner,
RevisionLookup $revisionLookup,
IBufferingStatsdDataFactory $statsdDataFactory,
PageEditStash $pageEditStash,
SkinFactory $skinFactory,
@ -61,7 +58,6 @@ class ApiVisualEditorEdit extends ApiBase {
$this->setLogger( LoggerFactory::getInstance( 'VisualEditor' ) );
$this->setStats( $statsdDataFactory );
$this->hookRunner = $hookRunner;
$this->revisionLookup = $revisionLookup;
$this->pageEditStash = $pageEditStash;
$this->skinFactory = $skinFactory;
$this->wikiPageFactory = $wikiPageFactory;
@ -138,7 +134,7 @@ class ApiVisualEditorEdit extends ApiBase {
*
* @param int $newRevId The revision to load
* @param array $params Original request params
* @return array|false The parsed of the save attempt
* @return array Some properties haphazardly extracted from an action=parse API response
*/
protected function parseWikitext( $newRevId, array $params ) {
$apiParams = [
@ -183,16 +179,6 @@ class ApiVisualEditorEdit extends ApiBase {
);
$jsconfigvars = $result['parse']['jsconfigvars'] ?? [];
if (
$content === false ||
// TODO: Is this check still needed?
( strlen( $content ) && $this->revisionLookup
->getRevisionById( $result['parse']['revid'] ) === null
)
) {
return false;
}
if ( $displaytitle !== false ) {
// Escape entities as in OutputPage::setPageTitle()
$displaytitle = Sanitizer::removeSomeTags( $displaytitle );
@ -465,9 +451,6 @@ class ApiVisualEditorEdit extends ApiBase {
// Return result of parseWikitext instead of saveWikitext so that the
// frontend can update the page rendering without a refresh.
$parseWikitextResult = $this->parseWikitext( $newRevId, $params );
if ( $parseWikitextResult === false ) {
$this->dieWithError( 'apierror-visualeditor-docserver', 'docserver' );
}
$result = array_merge( $result, $parseWikitextResult );