Merge "ApiDiscussionToolsPageInfo: Show nice error for deleted revisions"

This commit is contained in:
jenkins-bot 2024-11-20 19:56:42 +00:00 committed by Gerrit Code Review
commit 4be9db5ef3

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 ) {