Merge "Revert "Log the reason why revision->getContent() returns null""
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.revisionDelete.js
1 /*!
2 * JavaScript for Special:RevisionDelete
3 */
4 ( function ( mw, $ ) {
5 var colonSeparator = mw.message( 'colon-separator' ).text(),
6 summaryCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ),
7 summaryByteLimit = mw.config.get( 'wgCommentByteLimit' ),
8 $wpRevDeleteReasonList = $( '#wpRevDeleteReasonList' ),
9 $wpReason = $( '#wpReason' ),
10 filterFn = function ( input ) {
11 // Should be built the same as in SpecialRevisionDelete::submit()
12 var comment = $wpRevDeleteReasonList.val();
13 if ( comment === 'other' ) {
14 comment = input;
15 } else if ( input !== '' ) {
16 // Entry from drop down menu + additional comment
17 comment += colonSeparator + input;
18 }
19 return comment;
20 };
21
22 // Limit to bytes or UTF-8 codepoints, depending on MediaWiki's configuration
23 if ( summaryCodePointLimit ) {
24 $wpReason.codePointLimit( summaryCodePointLimit, filterFn );
25 } else if ( summaryByteLimit ) {
26 $wpReason.bytePointLimit( summaryByteLimit, filterFn );
27 }
28
29 }( mediaWiki, jQuery ) );