Debian Codegraph @

resources/src/mediawiki.special.block/util.js

raw symbols SCIP
1 const util = {
2 /**
3 * Get the message for the given block flag
4 *
5 * @param {string} flag
6 * @return {string}
7 */
8 getBlockFlagMessage: function ( flag ) {
9 // Potential messages:
10 // * block-log-flags-anononly
11 // * block-log-flags-nocreate
12 // * block-log-flags-noautoblock
13 // * block-log-flags-noemail
14 // * block-log-flags-nousertalk
15 // * block-log-flags-angry-autoblock
16 // * block-log-flags-hiddenname
17 return mw.message( 'block-log-flags-' + flag ).text();
18 },
19 /**
20 * Format a timestamp
21 *
22 * @param {string} timestamp
23 * @param {string} duration
24 * @return {string}
25 */
26 formatTimestamp: function ( timestamp, duration ) {
27 if ( mw.util.isInfinity( duration ) ) {
28 return mw.msg( 'infiniteblock' );
29 }
30 return new Date( timestamp ).toLocaleString();
31 },
32 /**
33 * Get the message for a given block action
34 *
35 * @param {string} action
36 * @return {string}
37 */
38 getBlockActionMessage: function ( action ) {
39 // Potential messages:
40 // * log-action-filter-block-block
41 // * log-action-filter-block-reblock
42 // * log-action-filter-block-unblock
43 return mw.message( 'log-action-filter-block-' + action ).text();
44 }
45 };
46
47 module.exports = util;