ApiDiscussionToolsCompare: Show nice error for deleted revisions

Bug: T362814
Change-Id: Iecc3e3737fcc82a79e699fe0bc00f373ecabf0c2
This commit is contained in:
Bartosz Dziewoński 2024-04-26 03:49:32 +02:00
parent f3e96a72fa
commit b8a28d6cfc

View file

@ -55,6 +55,11 @@ class ApiDiscussionToolsCompare extends ApiBase {
); );
} }
} }
// To keep things simple, don't allow viewing deleted revisions through this API
// (even if the current user could view them if we checked with userCan()).
if ( !$rev->audienceCan( RevisionRecord::DELETED_TEXT, RevisionRecord::FOR_PUBLIC ) ) {
$this->dieWithError( [ 'apierror-missingcontent-revid', $rev->getId() ], 'missingcontent' );
}
return $rev; return $rev;
} }