Migrate remaining usages of Title::userCan() to PermissionManager
[lhc/web/wiklou.git] / includes / actions / McrUndoAction.php
index b60820c..41cd24e 100644 (file)
@@ -30,7 +30,7 @@ class McrUndoAction extends FormAction {
 
        protected $undo = 0, $undoafter = 0, $cur = 0;
 
-       /** @param RevisionRecord|null */
+       /** @var RevisionRecord|null */
        protected $curRev = null;
 
        public function getName() {
@@ -298,7 +298,7 @@ class McrUndoAction extends FormAction {
                        'class' => 'mw-content-' . $pageViewLang->getDir() ];
                $previewHTML = Html::rawElement( 'div', $attribs, $previewHTML );
 
-               $out->addHtml( $previewhead . $previewHTML );
+               $out->addHTML( $previewhead . $previewHTML );
        }
 
        public function onSubmit( $data ) {
@@ -336,8 +336,14 @@ class McrUndoAction extends FormAction {
                        $updater->setOriginalRevisionId( false );
                        $updater->setUndidRevisionId( $this->undo );
 
+                       $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
+
                        // TODO: Ugh.
-                       if ( $wgUseRCPatrol && $this->getTitle()->userCan( 'autopatrol', $this->getUser() ) ) {
+                       if ( $wgUseRCPatrol && $permissionManager->userCan(
+                               'autopatrol',
+                               $this->getUser(),
+                               $this->getTitle() )
+                       ) {
                                $updater->setRcPatrolStatus( RecentChange::PRC_AUTOPATROLLED );
                        }
 
@@ -358,8 +364,6 @@ class McrUndoAction extends FormAction {
 
        protected function getFormFields() {
                $request = $this->getRequest();
-               $config = $this->context->getConfig();
-               $oldCommentSchema = $config->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD;
                $ret = [
                        'diff' => [
                                'type' => 'info',
@@ -375,7 +379,7 @@ class McrUndoAction extends FormAction {
                                'name' => 'wpSummary',
                                'cssclass' => 'mw-summary',
                                'label-message' => 'summary',
-                               'maxlength' => $oldCommentSchema ? 200 : CommentStore::COMMENT_CHARACTER_LIMIT,
+                               'maxlength' => CommentStore::COMMENT_CHARACTER_LIMIT,
                                'value' => $request->getVal( 'wpSummary', '' ),
                                'size' => 60,
                                'spellcheck' => 'true',