Merge "Fix i18n message tog-watchlistunwatchlinks"
[lhc/web/wiklou.git] / includes / specials / SpecialUndelete.php
index 127a36b..540dbc6 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup SpecialPage
  */
 
-use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\IResultWrapper;
 
 /**
  * Special page allowing users with the appropriate permissions to view
@@ -306,7 +306,7 @@ class SpecialUndelete extends SpecialPage {
        /**
         * Generic list of deleted pages
         *
-        * @param ResultWrapper $result
+        * @param IResultWrapper $result
         * @return bool
         */
        private function showList( $result ) {
@@ -739,6 +739,9 @@ class SpecialUndelete extends SpecialPage {
                                'content' => new OOUI\HtmlSnippet( $this->msg( 'undeleteextrahelp' )->parseAsBlock() )
                        ] );
 
+                       $conf = $this->getConfig();
+                       $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD;
+
                        $fields[] = new OOUI\FieldLayout(
                                new OOUI\TextInputWidget( [
                                        'name' => 'wpComment',
@@ -746,6 +749,10 @@ class SpecialUndelete extends SpecialPage {
                                        'infusable' => true,
                                        'value' => $this->mComment,
                                        'autofocus' => true,
+                                       // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
+                                       // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
+                                       // Unicode codepoints (or 255 UTF-8 bytes for old schema).
+                                       'maxLength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT,
                                ] ),
                                [
                                        'label' => $this->msg( 'undeletecomment' )->text(),