ApiDiscussionToolsPageInfo: Show nice error for deleted revisions

This is similar fix as b8a28d6cfc.

Bug: T380351
Change-Id: I1b03a00c5627e1fa9e48aee9e2ed3d8b1ea332f7
This commit is contained in:
Ammarpad 2024-11-20 11:24:17 +01:00 committed by Bartosz Dziewoński
parent b6496ab427
commit 6e17c85409

View file

@ -12,6 +12,7 @@ use MediaWiki\Extension\DiscussionTools\ThreadItem\ContentHeadingItem;
use MediaWiki\Extension\DiscussionTools\ThreadItem\ContentThreadItem;
use MediaWiki\Extension\VisualEditor\VisualEditorParsoidClientFactory;
use MediaWiki\Revision\RevisionLookup;
use MediaWiki\Revision\RevisionRecord;
use MediaWiki\Title\Title;
use Wikimedia\ParamValidator\ParamValidator;
use Wikimedia\Parsoid\Core\ResourceLimitExceededException;
@ -112,6 +113,10 @@ class ApiDiscussionToolsPageInfo extends ApiBase {
return new ContentThreadItemSet;
}
if ( !$revision->audienceCan( RevisionRecord::DELETED_TEXT, RevisionRecord::FOR_PUBLIC ) ) {
$this->dieWithError( [ 'apierror-missingcontent-revid', $revision->getId() ], 'missingcontent' );
}
try {
return HookUtils::parseRevisionParsoidHtml( $revision, __METHOD__ );
} catch ( ResourceLimitExceededException $e ) {