- if ( $this->fetchContent ) {
- $this->addTables( 'text' );
- $this->addJoinConds(
- [ 'text' => [ 'LEFT JOIN', [ 'ar_text_id=old_id' ] ] ]
- );
- $this->addFields( [ 'old_text', 'old_flags' ] );
-
- // This also means stricter restrictions
- $this->checkUserRightsAny( [ 'deletedtext', 'undelete' ] );
+ // This means stricter restrictions
+ if ( ( $this->fld_comment || $this->fld_parsedcomment ) &&
+ !$this->getPermissionManager()->userHasRight( $user, 'deletedhistory' )
+ ) {
+ $this->dieWithError( 'apierror-cantview-deleted-comment', 'permissiondenied' );
+ }
+ if ( $this->fetchContent &&
+ !$this->getPermissionManager()->userHasAnyRight( $user, 'deletedtext', 'undelete' )
+ ) {
+ $this->dieWithError( 'apierror-cantview-deleted-revision-content', 'permissiondenied' );