private function showForm() {
global $wgOut, $wgUser, $wgRequest;
+ $conf = RequestContext::getMain()->getConfig();
+ $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD;
+
if ( $wgUser->isAllowed( 'suppressrevision' ) ) {
$suppress = "<tr id=\"wpDeleteSuppressRow\">
<td></td>
$suppress = '';
}
+ $wgOut->addModules( 'mediawiki.action.delete.file' );
+
$checkWatch = $wgUser->getBoolOption( 'watchdeletion' ) || $wgUser->isWatched( $this->title );
$form = Xml::openElement( 'form', [ 'method' => 'post', 'action' => $this->getAction(),
'id' => 'mw-img-deleteconfirm' ] ) .
Xml::label( wfMessage( 'filedelete-otherreason' )->text(), 'wpReason' ) .
"</td>
<td class='mw-input'>" .
- Xml::input( 'wpReason', 60, $wgRequest->getText( 'wpReason' ),
- [ 'type' => 'text', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason' ] ) .
+ Xml::input( 'wpReason', 60, $wgRequest->getText( 'wpReason' ), [
+ 'type' => 'text',
+ // 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,
+ 'tabindex' => '2',
+ 'id' => 'wpReason'
+ ] ) .
"</td>
</tr>
{$suppress}";