mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-23 18:28:51 +00:00
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:
parent
fbd33d63ee
commit
8573df0233
|
@ -195,7 +195,6 @@
|
||||||
"class": "MediaWiki\\Extension\\VisualEditor\\ApiVisualEditorEdit",
|
"class": "MediaWiki\\Extension\\VisualEditor\\ApiVisualEditorEdit",
|
||||||
"services": [
|
"services": [
|
||||||
"VisualEditorHookRunner",
|
"VisualEditorHookRunner",
|
||||||
"RevisionLookup",
|
|
||||||
"StatsdDataFactory",
|
"StatsdDataFactory",
|
||||||
"PageEditStash",
|
"PageEditStash",
|
||||||
"SkinFactory",
|
"SkinFactory",
|
||||||
|
|
|
@ -23,7 +23,6 @@ use FlaggablePageView;
|
||||||
use IBufferingStatsdDataFactory;
|
use IBufferingStatsdDataFactory;
|
||||||
use MediaWiki\Logger\LoggerFactory;
|
use MediaWiki\Logger\LoggerFactory;
|
||||||
use MediaWiki\Page\WikiPageFactory;
|
use MediaWiki\Page\WikiPageFactory;
|
||||||
use MediaWiki\Revision\RevisionLookup;
|
|
||||||
use MediaWiki\Storage\PageEditStash;
|
use MediaWiki\Storage\PageEditStash;
|
||||||
use MediaWiki\User\UserIdentity;
|
use MediaWiki\User\UserIdentity;
|
||||||
use ObjectCache;
|
use ObjectCache;
|
||||||
|
@ -40,7 +39,6 @@ class ApiVisualEditorEdit extends ApiBase {
|
||||||
private const MAX_CACHE_TTL = 900;
|
private const MAX_CACHE_TTL = 900;
|
||||||
|
|
||||||
private VisualEditorHookRunner $hookRunner;
|
private VisualEditorHookRunner $hookRunner;
|
||||||
private RevisionLookup $revisionLookup;
|
|
||||||
private PageEditStash $pageEditStash;
|
private PageEditStash $pageEditStash;
|
||||||
private SkinFactory $skinFactory;
|
private SkinFactory $skinFactory;
|
||||||
private WikiPageFactory $wikiPageFactory;
|
private WikiPageFactory $wikiPageFactory;
|
||||||
|
@ -50,7 +48,6 @@ class ApiVisualEditorEdit extends ApiBase {
|
||||||
ApiMain $main,
|
ApiMain $main,
|
||||||
string $name,
|
string $name,
|
||||||
VisualEditorHookRunner $hookRunner,
|
VisualEditorHookRunner $hookRunner,
|
||||||
RevisionLookup $revisionLookup,
|
|
||||||
IBufferingStatsdDataFactory $statsdDataFactory,
|
IBufferingStatsdDataFactory $statsdDataFactory,
|
||||||
PageEditStash $pageEditStash,
|
PageEditStash $pageEditStash,
|
||||||
SkinFactory $skinFactory,
|
SkinFactory $skinFactory,
|
||||||
|
@ -61,7 +58,6 @@ class ApiVisualEditorEdit extends ApiBase {
|
||||||
$this->setLogger( LoggerFactory::getInstance( 'VisualEditor' ) );
|
$this->setLogger( LoggerFactory::getInstance( 'VisualEditor' ) );
|
||||||
$this->setStats( $statsdDataFactory );
|
$this->setStats( $statsdDataFactory );
|
||||||
$this->hookRunner = $hookRunner;
|
$this->hookRunner = $hookRunner;
|
||||||
$this->revisionLookup = $revisionLookup;
|
|
||||||
$this->pageEditStash = $pageEditStash;
|
$this->pageEditStash = $pageEditStash;
|
||||||
$this->skinFactory = $skinFactory;
|
$this->skinFactory = $skinFactory;
|
||||||
$this->wikiPageFactory = $wikiPageFactory;
|
$this->wikiPageFactory = $wikiPageFactory;
|
||||||
|
@ -138,7 +134,7 @@ class ApiVisualEditorEdit extends ApiBase {
|
||||||
*
|
*
|
||||||
* @param int $newRevId The revision to load
|
* @param int $newRevId The revision to load
|
||||||
* @param array $params Original request params
|
* @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 ) {
|
protected function parseWikitext( $newRevId, array $params ) {
|
||||||
$apiParams = [
|
$apiParams = [
|
||||||
|
@ -183,16 +179,6 @@ class ApiVisualEditorEdit extends ApiBase {
|
||||||
);
|
);
|
||||||
$jsconfigvars = $result['parse']['jsconfigvars'] ?? [];
|
$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 ) {
|
if ( $displaytitle !== false ) {
|
||||||
// Escape entities as in OutputPage::setPageTitle()
|
// Escape entities as in OutputPage::setPageTitle()
|
||||||
$displaytitle = Sanitizer::removeSomeTags( $displaytitle );
|
$displaytitle = Sanitizer::removeSomeTags( $displaytitle );
|
||||||
|
@ -465,9 +451,6 @@ class ApiVisualEditorEdit extends ApiBase {
|
||||||
// Return result of parseWikitext instead of saveWikitext so that the
|
// Return result of parseWikitext instead of saveWikitext so that the
|
||||||
// frontend can update the page rendering without a refresh.
|
// frontend can update the page rendering without a refresh.
|
||||||
$parseWikitextResult = $this->parseWikitext( $newRevId, $params );
|
$parseWikitextResult = $this->parseWikitext( $newRevId, $params );
|
||||||
if ( $parseWikitextResult === false ) {
|
|
||||||
$this->dieWithError( 'apierror-visualeditor-docserver', 'docserver' );
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = array_merge( $result, $parseWikitextResult );
|
$result = array_merge( $result, $parseWikitextResult );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue