EBernhardson has uploaded a new change for review. https://gerrit.wikimedia.org/r/169596
Change subject: Convert javacript time handling to moment.js ...................................................................... Convert javacript time handling to moment.js Change-Id: I255e3d0e3cb2dd9ee61098230ac9f234db479e66 --- M .jshintrc M Resources.php M handlebars/compiled/flow_block_topic.handlebars.php M handlebars/compiled/flow_block_topic_moderate_post.handlebars.php M handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php M handlebars/compiled/flow_block_topiclist.handlebars.php M handlebars/compiled/flow_post.handlebars.php M handlebars/compiled/timestamp.handlebars.php M handlebars/flow_post_meta_actions.handlebars M handlebars/flow_topic_titlebar_content.handlebars A handlebars/foo M handlebars/timestamp.handlebars M i18n/en.json M i18n/qqq.json M includes/TemplateHelper.php M modules/engine/components/board/base/flow-board-load-events.js M modules/engine/misc/flow-handlebars.js M tests/qunit/engine/misc/test_flow-handlebars.js 18 files changed, 103 insertions(+), 288 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/96/169596/1 diff --git a/.jshintrc b/.jshintrc index 055b010..85b889e 100644 --- a/.jshintrc +++ b/.jshintrc @@ -14,7 +14,8 @@ "ve": true, "Handlebars": true, "initStorer": true, - "OO": true + "OO": true, + "moment": true }, "browser": true, // document, navigator, etc. "curly": true, // requres curly braces around loops and conditionals diff --git a/Resources.php b/Resources.php index 08365c8..bd767ec 100644 --- a/Resources.php +++ b/Resources.php @@ -19,7 +19,10 @@ $wgResourceModules += array( 'ext.flow.templating' => $flowTemplatingResourceTemplate + array( 'class' => 'ResourceLoaderTemplateModule', - 'dependencies' => 'ext.mantle.handlebars', + 'dependencies' => array( + 'ext.mantle.handlebars', + 'moment', + ), 'localTemplateBasePath' => $dir . 'handlebars', 'templates' => array( 'flow_anon_warning.handlebars', @@ -276,28 +279,6 @@ 'ext.flow.handlebars' => $flowResourceTemplate + array( 'scripts' => array( 'engine/misc/flow-handlebars.js', - ), - 'messages' => array( - 'flow-time-ago-second', - 'flow-time-ago-minute', - 'flow-time-ago-hour', - 'flow-time-ago-day', - 'flow-time-ago-week', - 'flow-active-ago-second', - 'flow-active-ago-minute', - 'flow-active-ago-hour', - 'flow-active-ago-day', - 'flow-active-ago-week', - 'flow-started-ago-second', - 'flow-started-ago-minute', - 'flow-started-ago-hour', - 'flow-started-ago-day', - 'flow-started-ago-week', - 'flow-edited-ago-second', - 'flow-edited-ago-minute', - 'flow-edited-ago-hour', - 'flow-edited-ago-day', - 'flow-edited-ago-week', ), 'dependencies' => array( 'ext.mantle.handlebars', diff --git a/handlebars/compiled/flow_block_topic.handlebars.php b/handlebars/compiled/flow_block_topic.handlebars.php index 706a79f..3c90c2a 100644 --- a/handlebars/compiled/flow_block_topic.handlebars.php +++ b/handlebars/compiled/flow_block_topic.handlebars.php @@ -68,16 +68,17 @@ <a href="'.htmlentities(((is_array($in['actions']['reply']) && isset($in['actions']['reply']['url'])) ? $in['actions']['reply']['url'] : null), ENT_QUOTES, 'UTF-8').'" title="'.htmlentities(((is_array($in['actions']['reply']) && isset($in['actions']['reply']['title'])) ? $in['actions']['reply']['title'] : null), ENT_QUOTES, 'UTF-8').'" class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" - data-flow-interactive-handler="activateForm">'.htmlentities(((is_array($in['actions']['reply']) && isset($in['actions']['reply']['title'])) ? $in['actions']['reply']['title'] : null), ENT_QUOTES, 'UTF-8').'</a> + data-flow-interactive-handler="activateForm" + >'.htmlentities(((is_array($in['actions']['reply']) && isset($in['actions']['reply']['title'])) ? $in['actions']['reply']['title'] : null), ENT_QUOTES, 'UTF-8').'</a> • ' : '').' '.LCRun3::ch($cx, 'l10n', Array(Array('flow-topic-comments',((is_array($in) && isset($in['reply_count'])) ? $in['reply_count'] : null)),Array()), 'encq').' • '.((LCRun3::ifvar($cx, ((is_array($in) && isset($in['last_updated'])) ? $in['last_updated'] : null))) ? ' - '.LCRun3::ch($cx, 'timestamp', Array(Array(((is_array($in) && isset($in['last_updated'])) ? $in['last_updated'] : null),'flow-active-ago',false,((is_array($in) && isset($in['last_updated_readable'])) ? $in['last_updated_readable'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'timestamp', Array(Array(((is_array($in) && isset($in['last_updated'])) ? $in['last_updated'] : null)),Array()), 'encq').' ' : ' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null),'flow-started-ago',false),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null)),Array()), 'encq').' ').' </div> '.((LCRun3::ifvar($cx, ((is_array($in) && isset($in['isModerated'])) ? $in['isModerated'] : null))) ? ' diff --git a/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php index 02fbff2..8d86061 100644 --- a/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php +++ b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php @@ -224,13 +224,13 @@ class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" title="'.htmlentities(((is_array($in['links']['diff-prev']) && isset($in['links']['diff-prev']['title'])) ? $in['links']['diff-prev']['title'] : null), ENT_QUOTES, 'UTF-8').'"> ' : '').' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['revisionId'])) ? $in['revisionId'] : null),'flow-edited-ago',((is_array($in) && isset($in['1'])) ? $in['1'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['revisionId'])) ? $in['revisionId'] : null),true),Array()), 'encq').' '.((LCRun3::ifvar($cx, ((is_array($in['links']) && isset($in['links']['diff-prev'])) ? $in['links']['diff-prev'] : null))) ? ' </a> ' : '').' • ' : '').' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null),'flow-time-ago',((is_array($in) && isset($in['0'])) ? $in['0'] : null),((is_array($in) && isset($in['timestamp_readable'])) ? $in['timestamp_readable'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null)),Array()), 'encq').' </div> <div class="flow-menu"> @@ -419,13 +419,13 @@ class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" title="'.htmlentities(((is_array($in['links']['diff-prev']) && isset($in['links']['diff-prev']['title'])) ? $in['links']['diff-prev']['title'] : null), ENT_QUOTES, 'UTF-8').'"> ' : '').' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['revisionId'])) ? $in['revisionId'] : null),'flow-edited-ago',((is_array($in) && isset($in['1'])) ? $in['1'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['revisionId'])) ? $in['revisionId'] : null),true),Array()), 'encq').' '.((LCRun3::ifvar($cx, ((is_array($in['links']) && isset($in['links']['diff-prev'])) ? $in['links']['diff-prev'] : null))) ? ' </a> ' : '').' • ' : '').' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null),'flow-time-ago',((is_array($in) && isset($in['0'])) ? $in['0'] : null),((is_array($in) && isset($in['timestamp_readable'])) ? $in['timestamp_readable'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null)),Array()), 'encq').' </div> <div class="flow-menu"> diff --git a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php index 12b047c..d510a10 100644 --- a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php +++ b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php @@ -224,13 +224,13 @@ class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" title="'.htmlentities(((is_array($in['links']['diff-prev']) && isset($in['links']['diff-prev']['title'])) ? $in['links']['diff-prev']['title'] : null), ENT_QUOTES, 'UTF-8').'"> ' : '').' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['revisionId'])) ? $in['revisionId'] : null),'flow-edited-ago',((is_array($in) && isset($in['1'])) ? $in['1'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['revisionId'])) ? $in['revisionId'] : null),true),Array()), 'encq').' '.((LCRun3::ifvar($cx, ((is_array($in['links']) && isset($in['links']['diff-prev'])) ? $in['links']['diff-prev'] : null))) ? ' </a> ' : '').' • ' : '').' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null),'flow-time-ago',((is_array($in) && isset($in['0'])) ? $in['0'] : null),((is_array($in) && isset($in['timestamp_readable'])) ? $in['timestamp_readable'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null)),Array()), 'encq').' </div> <div class="flow-menu"> @@ -419,13 +419,13 @@ class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" title="'.htmlentities(((is_array($in['links']['diff-prev']) && isset($in['links']['diff-prev']['title'])) ? $in['links']['diff-prev']['title'] : null), ENT_QUOTES, 'UTF-8').'"> ' : '').' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['revisionId'])) ? $in['revisionId'] : null),'flow-edited-ago',((is_array($in) && isset($in['1'])) ? $in['1'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['revisionId'])) ? $in['revisionId'] : null),true),Array()), 'encq').' '.((LCRun3::ifvar($cx, ((is_array($in['links']) && isset($in['links']['diff-prev'])) ? $in['links']['diff-prev'] : null))) ? ' </a> ' : '').' • ' : '').' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null),'flow-time-ago',((is_array($in) && isset($in['0'])) ? $in['0'] : null),((is_array($in) && isset($in['timestamp_readable'])) ? $in['timestamp_readable'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null)),Array()), 'encq').' </div> <div class="flow-menu"> diff --git a/handlebars/compiled/flow_block_topiclist.handlebars.php b/handlebars/compiled/flow_block_topiclist.handlebars.php index 53c4310..c534c67 100644 --- a/handlebars/compiled/flow_block_topiclist.handlebars.php +++ b/handlebars/compiled/flow_block_topiclist.handlebars.php @@ -184,16 +184,17 @@ <a href="'.htmlentities(((is_array($in['actions']['reply']) && isset($in['actions']['reply']['url'])) ? $in['actions']['reply']['url'] : null), ENT_QUOTES, 'UTF-8').'" title="'.htmlentities(((is_array($in['actions']['reply']) && isset($in['actions']['reply']['title'])) ? $in['actions']['reply']['title'] : null), ENT_QUOTES, 'UTF-8').'" class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" - data-flow-interactive-handler="activateForm">'.htmlentities(((is_array($in['actions']['reply']) && isset($in['actions']['reply']['title'])) ? $in['actions']['reply']['title'] : null), ENT_QUOTES, 'UTF-8').'</a> + data-flow-interactive-handler="activateForm" + >'.htmlentities(((is_array($in['actions']['reply']) && isset($in['actions']['reply']['title'])) ? $in['actions']['reply']['title'] : null), ENT_QUOTES, 'UTF-8').'</a> • ' : '').' '.LCRun3::ch($cx, 'l10n', Array(Array('flow-topic-comments',((is_array($in) && isset($in['reply_count'])) ? $in['reply_count'] : null)),Array()), 'encq').' • '.((LCRun3::ifvar($cx, ((is_array($in) && isset($in['last_updated'])) ? $in['last_updated'] : null))) ? ' - '.LCRun3::ch($cx, 'timestamp', Array(Array(((is_array($in) && isset($in['last_updated'])) ? $in['last_updated'] : null),'flow-active-ago',false,((is_array($in) && isset($in['last_updated_readable'])) ? $in['last_updated_readable'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'timestamp', Array(Array(((is_array($in) && isset($in['last_updated'])) ? $in['last_updated'] : null)),Array()), 'encq').' ' : ' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null),'flow-started-ago',false),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null)),Array()), 'encq').' ').' </div> '.((LCRun3::ifvar($cx, ((is_array($in) && isset($in['isModerated'])) ? $in['isModerated'] : null))) ? ' diff --git a/handlebars/compiled/flow_post.handlebars.php b/handlebars/compiled/flow_post.handlebars.php index 73768b0..026f7d0 100644 --- a/handlebars/compiled/flow_post.handlebars.php +++ b/handlebars/compiled/flow_post.handlebars.php @@ -186,13 +186,13 @@ class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" title="'.htmlentities(((is_array($in['links']['diff-prev']) && isset($in['links']['diff-prev']['title'])) ? $in['links']['diff-prev']['title'] : null), ENT_QUOTES, 'UTF-8').'"> ' : '').' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['revisionId'])) ? $in['revisionId'] : null),'flow-edited-ago',((is_array($in) && isset($in['1'])) ? $in['1'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['revisionId'])) ? $in['revisionId'] : null),true),Array()), 'encq').' '.((LCRun3::ifvar($cx, ((is_array($in['links']) && isset($in['links']['diff-prev'])) ? $in['links']['diff-prev'] : null))) ? ' </a> ' : '').' • ' : '').' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null),'flow-time-ago',((is_array($in) && isset($in['0'])) ? $in['0'] : null),((is_array($in) && isset($in['timestamp_readable'])) ? $in['timestamp_readable'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null)),Array()), 'encq').' </div> <div class="flow-menu"> @@ -381,13 +381,13 @@ class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" title="'.htmlentities(((is_array($in['links']['diff-prev']) && isset($in['links']['diff-prev']['title'])) ? $in['links']['diff-prev']['title'] : null), ENT_QUOTES, 'UTF-8').'"> ' : '').' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['revisionId'])) ? $in['revisionId'] : null),'flow-edited-ago',((is_array($in) && isset($in['1'])) ? $in['1'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['revisionId'])) ? $in['revisionId'] : null),true),Array()), 'encq').' '.((LCRun3::ifvar($cx, ((is_array($in['links']) && isset($in['links']['diff-prev'])) ? $in['links']['diff-prev'] : null))) ? ' </a> ' : '').' • ' : '').' - '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null),'flow-time-ago',((is_array($in) && isset($in['0'])) ? $in['0'] : null),((is_array($in) && isset($in['timestamp_readable'])) ? $in['timestamp_readable'] : null)),Array()), 'encq').' + '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) && isset($in['postId'])) ? $in['postId'] : null)),Array()), 'encq').' </div> <div class="flow-menu"> diff --git a/handlebars/compiled/timestamp.handlebars.php b/handlebars/compiled/timestamp.handlebars.php index b280c04..a5a10aa 100644 --- a/handlebars/compiled/timestamp.handlebars.php +++ b/handlebars/compiled/timestamp.handlebars.php @@ -16,18 +16,18 @@ 'sp_vars' => Array(), ); - return ''.((LCRun3::ifvar($cx, ((is_array($in) && isset($in['time_ago'])) ? $in['time_ago'] : null))) ? ' - '.((LCRun3::ifvar($cx, ((is_array($in) && isset($in['guid'])) ? $in['guid'] : null))) ? ' - <time datetime="'.htmlentities(((is_array($in) && isset($in['time_iso'])) ? $in['time_iso'] : null), ENT_QUOTES, 'UTF-8').'" class="flow-timestamp"> - <span class="flow-timestamp-now">'.htmlentities(((is_array($in) && isset($in['time_readable'])) ? $in['time_readable'] : null), ENT_QUOTES, 'UTF-8').'</span> - <span id="'.htmlentities(((is_array($in) && isset($in['guid'])) ? $in['guid'] : null), ENT_QUOTES, 'UTF-8').'" class="flow-timestamp-ago">'.htmlentities(((is_array($in) && isset($in['time_ago'])) ? $in['time_ago'] : null), ENT_QUOTES, 'UTF-8').'</span> - </time> - ' : ' - <time datetime="'.htmlentities(((is_array($in) && isset($in['time_iso'])) ? $in['time_iso'] : null), ENT_QUOTES, 'UTF-8').'" class="flow-timestamp flow-load-interactive" data-flow-load-handler="timestamp" data-time-str="'.htmlentities(((is_array($in) && isset($in['time_str'])) ? $in['time_str'] : null), ENT_QUOTES, 'UTF-8').'" data-time-ago-only="'.htmlentities(((is_array($in) && isset($in['time_ago_only'])) ? $in['time_ago_only'] : null), ENT_QUOTES, 'UTF-8').'">'.htmlentities(((is_array($in) && isset($in['time_readable'])) ? $in['time_readable'] : null), ENT_QUOTES, 'UTF-8').'</time> - ').' + return ''.((LCRun3::ifvar($cx, ((is_array($in) && isset($in['guid'])) ? $in['guid'] : null))) ? ' + <time datetime="'.htmlentities(((is_array($in) && isset($in['time_iso'])) ? $in['time_iso'] : null), ENT_QUOTES, 'UTF-8').'" class="flow-timestamp"> ' : ' - <time datetime="'.htmlentities(((is_array($in) && isset($in['time_iso'])) ? $in['time_iso'] : null), ENT_QUOTES, 'UTF-8').'" class="flow-timestamp">'.htmlentities(((is_array($in) && isset($in['time_readable'])) ? $in['time_readable'] : null), ENT_QUOTES, 'UTF-8').'</time> + <time datetime="'.htmlentities(((is_array($in) && isset($in['time_iso'])) ? $in['time_iso'] : null), ENT_QUOTES, 'UTF-8').'" + class="flow-timestamp flow-load-interactive" + data-flow-load-handler="timestamp" + data-time-ago-only="'.htmlentities(((is_array($in) && isset($in['time_ago_only'])) ? $in['time_ago_only'] : null), ENT_QUOTES, 'UTF-8').'" + > ').' + <span class="flow-timestamp-now">'.htmlentities(((is_array($in) && isset($in['time_readable'])) ? $in['time_readable'] : null), ENT_QUOTES, 'UTF-8').'</span> + <span id="'.htmlentities(((is_array($in) && isset($in['guid'])) ? $in['guid'] : null), ENT_QUOTES, 'UTF-8').'" class="flow-timestamp-ago">'.htmlentities(((is_array($in) && isset($in['time_ago'])) ? $in['time_ago'] : null), ENT_QUOTES, 'UTF-8').'</span> +</time> '; } ?> \ No newline at end of file diff --git a/handlebars/flow_post_meta_actions.handlebars b/handlebars/flow_post_meta_actions.handlebars index 89a67a2..268b4a1 100644 --- a/handlebars/flow_post_meta_actions.handlebars +++ b/handlebars/flow_post_meta_actions.handlebars @@ -36,11 +36,11 @@ class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" title="{{links.diff-prev.title}}"> {{/if}} - {{uuidTimestamp revisionId "flow-edited-ago" 1}} + {{uuidTimestamp revisionId true}} {{#if links.diff-prev}} </a> {{/if}} • {{/if}} - {{uuidTimestamp postId "flow-time-ago" 0 timestamp_readable}} + {{uuidTimestamp postId}} </div> diff --git a/handlebars/flow_topic_titlebar_content.handlebars b/handlebars/flow_topic_titlebar_content.handlebars index a0394d8..fa92363 100644 --- a/handlebars/flow_topic_titlebar_content.handlebars +++ b/handlebars/flow_topic_titlebar_content.handlebars @@ -4,7 +4,8 @@ <a href="{{actions.reply.url}}" title="{{actions.reply.title}}" class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" - data-flow-interactive-handler="activateForm"> + data-flow-interactive-handler="activateForm" + > {{~actions.reply.title~}} </a> • @@ -13,9 +14,9 @@ {{l10n "flow-topic-comments" reply_count}} • {{#if last_updated}} - {{timestamp last_updated "flow-active-ago" false last_updated_readable}} + {{timestamp last_updated}} {{else}} - {{uuidTimestamp postId "flow-started-ago" false}} + {{uuidTimestamp postId}} {{/if}} </div> {{#if isModerated}} diff --git a/handlebars/foo b/handlebars/foo new file mode 100644 index 0000000..312df86 --- /dev/null +++ b/handlebars/foo @@ -0,0 +1,2 @@ +GET /wiki/Talk:Flow HTTP/1.1 +Host: www.mediawiki.org diff --git a/handlebars/timestamp.handlebars b/handlebars/timestamp.handlebars index 62c03b6..ce61575 100644 --- a/handlebars/timestamp.handlebars +++ b/handlebars/timestamp.handlebars @@ -1,12 +1,12 @@ -{{#if time_ago}} - {{#if guid}} - <time datetime="{{time_iso}}" class="flow-timestamp"> - <span class="flow-timestamp-now">{{time_readable}}</span> - <span id="{{guid}}" class="flow-timestamp-ago">{{time_ago}}</span> - </time> - {{else}} - <time datetime="{{time_iso}}" class="flow-timestamp flow-load-interactive" data-flow-load-handler="timestamp" data-time-str="{{time_str}}" data-time-ago-only="{{time_ago_only}}">{{time_readable}}</time> - {{/if}} +{{#if guid}} + <time datetime="{{time_iso}}" class="flow-timestamp"> {{else}} - <time datetime="{{time_iso}}" class="flow-timestamp">{{time_readable}}</time> + <time datetime="{{time_iso}}" + class="flow-timestamp flow-load-interactive" + data-flow-load-handler="timestamp" + data-time-ago-only="{{time_ago_only}}" + > {{/if}} + <span class="flow-timestamp-now">{{time_readable}}</span> + <span id="{{guid}}" class="flow-timestamp-ago">{{time_ago}}</span> +</time> diff --git a/i18n/en.json b/i18n/en.json index 9846949..679b695 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -326,18 +326,6 @@ "flow-topic-html-title": "$1 on $2", "flow-topic-count-sidebar": "Showing $1 of $2 topics attached to this page", "flow-topic-count": "Topics ($1)", - "flow-active-ago": "Active $1", - "flow-started-ago": "Started $1", - "flow-started-ago-day": "Started $1 {{PLURAL:$1|day|days}} ago", - "flow-started-ago-hour": "Started $1 {{PLURAL:$1|hour|hours}} ago", - "flow-started-ago-minute": "Started $1 {{PLURAL:$1|minute|minutes}} ago", - "flow-started-ago-second": "Started $1 {{PLURAL:$1|second|seconds}} ago", - "flow-started-ago-week": "Started $1 {{PLURAL:$1|week|weeks}} ago", - "flow-edited-ago-day": "Edited $1 {{PLURAL:$1|day|days}} ago", - "flow-edited-ago-hour": "Edited $1 {{PLURAL:$1|hour|hours}} ago", - "flow-edited-ago-minute": "Edited $1 {{PLURAL:$1|minute|minutes}} ago", - "flow-edited-ago-second": "Edited $1 {{PLURAL:$1|second|seconds}} ago", - "flow-edited-ago-week": "Edited $1 {{PLURAL:$1|week|weeks}} ago", "flow-load-more": "Load More", "flow-no-more-fwd": "There are no older topics", "flow-add-topic": "Add Topic ", @@ -364,15 +352,5 @@ "flow-preview-return-edit-post": "Keep editing", "flow-anonymous": "Anonymous", "flow-embedding-unsupported": "Discussions cannot be embedded yet.", - "mw-ui-unsubmitted-confirm": "You have unsubmitted changes on this page. Are you sure you want to navigate away and lose your work?", - "flow-active-ago-day": "Active $1 {{PLURAL:$1|day|days}} ago", - "flow-active-ago-hour": "Active $1 {{PLURAL:$1|hour|hours}} ago", - "flow-active-ago-minute": "Active $1 {{PLURAL:$1|minute|minutes}} ago", - "flow-active-ago-second": "Active $1 {{PLURAL:$1|second|seconds}} ago", - "flow-active-ago-week": "Active $1 {{PLURAL:$1|week|weeks}} ago", - "flow-time-ago-day": "$1 {{PLURAL:$1|day|days}} ago", - "flow-time-ago-hour": "$1 {{PLURAL:$1|hour|hours}} ago", - "flow-time-ago-minute": "$1 {{PLURAL:$1|minute|minutes}} ago", - "flow-time-ago-second": "$1 {{PLURAL:$1|second|seconds}} ago", - "flow-time-ago-week": "$1 {{PLURAL:$1|week|weeks}} ago" + "mw-ui-unsubmitted-confirm": "You have unsubmitted changes on this page. Are you sure you want to navigate away and lose your work?" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 80179ee..b446431 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -330,18 +330,6 @@ "flow-topic-html-title": "Message displayed in the browser title bar when visiting a page in the Topic namespace. Parameters:\n* $1 - The title of the topic\n* $2 - The page the topic started on\n{{Identical|On}}", "flow-topic-count-sidebar": "Message displayed at the bottom of the sidebar showing the number of topics current displayed and the total available.", "flow-topic-count": "Message displayed at the top of the sidebar showing the number of topics loaded on the page\n{{Identical|Topic}}", - "flow-active-ago": "Message displayed in the topic title bar to indicate how long ago the topic was last changed. Parameters:\n* $1 - Humanized time ago from CLDR. ex: 17 hours ago\n{{Related|Flow-active-ago}}\n{{Identical|Active}}", - "flow-started-ago": "Message displayed in the topic title bar to indicate how long ago the topic was created. Parameters:\n* $1 - Humanized time ago from CLDR. ex: 17 hours ago\n{{Related|Flow-started-ago}}\n{{Identical|Started}}", - "flow-started-ago-day": "A statement described the time passed since a topic was started. Parameters:\n* $1 - days that have passed since event\n{{Related|Flow-started-ago}}", - "flow-started-ago-hour": "A statement described the time passed since a topic was started. Parameters:\n* $1 - hours that have passed since event\n{{Related|Flow-started-ago}}", - "flow-started-ago-minute": "A statement described the time passed since a topic was started. Parameters:\n* $1 - minutes that have passed since event\n{{Related|Flow-started-ago}}", - "flow-started-ago-second": "A statement described the time passed since a topic was started. Parameters:\n* $1 - seconds that have passed since event\n{{Related|Flow-started-ago}}", - "flow-started-ago-week": "A statement described the time passed since a topic was started. Parameters:\n* $1 - weeks that have passed since event\n{{Related|Flow-started-ago}}", - "flow-edited-ago-day": "A statement described the time passed since a post was edited. Parameters:\n* $1 - days that have passed since event\n{{Related|Flow-edited-ago}}", - "flow-edited-ago-hour": "A statement described the time passed since a post was edited. Parameters:\n* $1 - hours that have passed since event\n{{Related|Flow-edited-ago}}", - "flow-edited-ago-minute": "A statement described the time passed since a post was edited. Parameters:\n* $1 - minutes that have passed since event\n{{Related|Flow-edited-ago}}", - "flow-edited-ago-second": "A statement described the time passed since a post was edited. Parameters:\n* $1 - seconds that have passed since event\n{{Related|Flow-edited-ago}}", - "flow-edited-ago-week": "A statement described the time passed since a post was edited. Parameters:\n* $1 - weeks that have passed since event\n{{Related|Flow-edited-ago}}", "flow-load-more": "Message displayed inside a button that fetches more topics and appends them to the bottom of the page\n{{Identical|Load more}}", "flow-no-more-fwd": "Displayed instead of 'flow-load-more' when there are no more topics to show in the forward direction", "flow-add-topic": "Button text for submitting a new topic to the page", @@ -368,15 +356,5 @@ "flow-preview-return-edit-post": "Used as text for a button that hides previewed text and returns to the editing view", "flow-anonymous": "{{Identical|Anonymous}}", "flow-embedding-unsupported": "Error message displayed if a user tries to transclude a Flow page.", - "mw-ui-unsubmitted-confirm": "You have unsubmitted changes on this page. Are you sure you want to navigate away and lose your work?", - "flow-active-ago-day": "A statement described the time passed since a post was active. Appears under the post title and after the messages {{msg-mw|flow-topic-comments}} and {{msg-mw|flow-reply-link}}.\nParameters:\n* $1 - days that have passed since event\n{{Related|Flow-active-ago}}", - "flow-active-ago-hour": "A statement described the time passed since a post was active. Appears under the post title and after the messages {{msg-mw|flow-topic-comments}} and {{msg-mw|flow-reply-link}}.\nParameters:\n* $1 - hours that have passed since event\n{{Related|Flow-active-ago}}", - "flow-active-ago-minute": "A statement described the time passed since a post was active. Appears under the post title and after the messages {{msg-mw|flow-topic-comments}} and {{msg-mw|flow-reply-link}}.\nParameters:\n* $1 - minutes that have passed since event\n{{Related|Flow-active-ago}}", - "flow-active-ago-second": "A statement described the time passed since a post was active. Appears under the post title and after the messages {{msg-mw|flow-topic-comments}} and {{msg-mw|flow-reply-link}}.\nParameters:\n* $1 - seconds that have passed since event\n{{Related|Flow-active-ago}}", - "flow-active-ago-week": "A statement described the time passed since a post was active. Appears under the post title and after the messages {{msg-mw|flow-topic-comments}} and {{msg-mw|flow-reply-link}}.\nParameters:\n* $1 - weeks that have passed since event\n{{Related|Flow-active-ago}}", - "flow-time-ago-day": "A statement described the time passed since an event. Parameters:\n* $1 - days that have passed since event\n{{Related|Flow-time-ago}}", - "flow-time-ago-hour": "A statement described the time passed since an event. Parameters:\n* $1 - hours that have passed since event\n{{Related|Flow-time-ago}}", - "flow-time-ago-minute": "A statement described the time passed since an event. Parameters:\n* $1 - minutes that have passed since event\n{{Related|Flow-time-ago}}", - "flow-time-ago-second": "A statement described the time passed since an event. Parameters:\n* $1 - seconds that have passed since event\n{{Related|Flow-time-ago}}", - "flow-time-ago-week": "A statement described the time passed since an event. Parameters:\n* $1 - weeks that have passed since event\n{{Related|Flow-time-ago}}" + "mw-ui-unsubmitted-confirm": "You have unsubmitted changes on this page. Are you sure you want to navigate away and lose your work?" } diff --git a/includes/TemplateHelper.php b/includes/TemplateHelper.php index f2ba27f..268064d 100644 --- a/includes/TemplateHelper.php +++ b/includes/TemplateHelper.php @@ -9,6 +9,7 @@ use Closure; use HTML; use LightnCandy; +use MWTimestamp; use RequestContext; use Title; @@ -192,41 +193,6 @@ // Helpers /** - * Localize message. - * If given a simple MW message key this will convert it using the usual wfMessage() function, - * storing it in a cache. It may also perform special processing of other messages such as - * timestamps and topic counts. - */ - // @todo: Maybe the straight message lookup should be a separate msg helper function, for clarity? - static public function l10n( array $args, array $named ) { - $message = null; - // pull $str out of $args - $str = array_shift( $args ); - - switch( $str ) { - case 'time': - // This one is not used right now. The parsing of - // "x time ago" is done client-side (see its radically different - // implementation of the "timestamp" helper, which is the only place - // these l10n's are used) - break; - - case 'datetime': - // This one is not really used right now. The parsing of - // "x time ago" is done client-side (see its radically different - // implementation of the "timestamp" helper, which is the only place - // these l10n's are used) - break; - } - - if ( $message ) { - return $message->text(); - } else { - return wfMessage( $str )->params( $args )->text(); - } - } - - /** * Generates a timestamp using the UUID, then calls the timestamp helper with it. * @param array $args Expects string $uuid, string $str, bool $timeAgoOnly = false * @param array $named No named arguments expected @@ -234,12 +200,11 @@ * @throws WrongNumberArgumentsException */ static public function uuidTimestamp( array $args, array $named ) { - if ( count( $args ) < 2 ) { - throw new WrongNumberArgumentsException( $args, 'two', 'three' ); + if ( count( $args ) < 1 || count( $args ) > 2 ) { + throw new WrongNumberArgumentsException( $args, 'one', 'two' ); } $uuid = $args[0]; - $str = $args[1]; - $timeAgoOnly = isset( $args[2] ) ? $args[2] : false; + $timeAgoOnly = isset( $args[1] ) ? $args[1] : false; $obj = UUID::create( $uuid ); if ( !$obj ) { @@ -258,42 +223,43 @@ * @throws WrongNumberArgumentsException */ static public function timestampHelper( array $args, array $named ) { - if ( count( $args ) < 2 ) { - throw new WrongNumberArgumentsException( $args, 'two' ); + if ( count( $args ) < 1 || count( $args ) > 2 ) { + throw new WrongNumberArgumentsException( $args, 'one', 'two' ); } return self::timestamp( $args[0], - $args[1], - isset( $args[2] ) ? $args[2] : false + isset( $args[1] ) ? $args[1] : false ); } /** * This server-side version of timestamp does not render time-ago. * @param integer $timestamp milliseconds since the unix epoch - * @param string $str i18n key name for ago message - * @param boolean $timeAgoOnly Only render the 'X minutes ago' portion + * @param boolean $timeAgoOnly true to return plaintext '5 hours ago' * @return string|false */ - static protected function timestamp( $timestamp, $str, $timeAgoOnly = false ) { + static protected function timestamp( $timestamp, $timeAgoOnly = false ) { global $wgLang, $wgUser; - if ( !$timestamp || !$str || $timeAgoOnly === true ) { + if ( !$timestamp ) { return false; } // source timestamps are in ms $timestamp /= 1000; + $ts = new MWTimestamp( $timestamp ); + + if ( $timeAgoOnly ) { + return $ts->getHumanTimestamp(); + } return self::html( self::processTemplate( 'timestamp', array( 'time_iso' => $timestamp, - // do not like - 'time_readable' => $wgLang->userTimeAndDate( $timestamp, $wgUser ), - 'time_ago' => true, //generated client-side - 'time_str' => $str, + 'time_ago' => $ts->getHumanTimestamp(), 'time_ago_only' => $timeAgoOnly ? 1 : 0, + 'time_readable' => $wgLang->userTimeAndDate( $timestamp, $wgUser ), 'guid' => null, //generated client-side ) ) ); @@ -553,7 +519,18 @@ /** * @param array $args one or more arguments, i18n key and parameters * @param array $named unused - * @return string[] + * @return string Plaintext + */ + static public function l10n( array $args, array $named ) { + $message = null; + $str = array_shift( $args ); + + return wfMessage( $str )->params( $args )->text(); + } + /** + * @param array $args one or more arguments, i18n key and parameters + * @param array $named unused + * @return string[] HTML */ static public function l10nParse( array $args, array $named ) { $str = array_shift( $args ); diff --git a/modules/engine/components/board/base/flow-board-load-events.js b/modules/engine/components/board/base/flow-board-load-events.js index 558bb34..94912c7 100644 --- a/modules/engine/components/board/base/flow-board-load-events.js +++ b/modules/engine/components/board/base/flow-board-load-events.js @@ -74,9 +74,7 @@ mw.flow.TemplateEngine.callHelper( 'timestamp', parseInt( $time.attr( 'datetime' ), 10) * 1000, - $time.data( 'time-str' ), - $time.data( 'time-ago-only' ) === "1", - $time.text() + $time.data( 'time-ago-only' ) === "1" ) ); }; @@ -108,4 +106,4 @@ // Mixin to FlowBoardComponent mw.flow.mixinComponent( 'board', FlowBoardComponentLoadEventsMixin ); -}( jQuery, mediaWiki ) ); \ No newline at end of file +}( jQuery, mediaWiki ) ); diff --git a/modules/engine/misc/flow-handlebars.js b/modules/engine/misc/flow-handlebars.js index d543a7f..5f5ff41 100644 --- a/modules/engine/misc/flow-handlebars.js +++ b/modules/engine/misc/flow-handlebars.js @@ -2,7 +2,7 @@ * Implements a Handlebars layer for FlowBoard.TemplateEngine */ -( function ( $, undefined ) { +( function ( $, moment, undefined ) { window.mw = window.mw || {}; // mw-less testing mw.flow = mw.flow || {}; // create mw.flow globally @@ -180,62 +180,6 @@ } ); } - // @todo remove and replace with mw.message || $.noop - /** - * Checks for a helper function based on a key. - * - * If not found, uses the mw.message API. - * - * In either case, optional variable arguments are passed (either as Message parameters or to - * the custom function) - * - * @param {string} str Key for message - * @param Object... [parameters] Parameters to pass as Message parameters or custom function - * parameters - */ - function flowMessages( str ) { - var parameters = flowNormalizeL10nParameters( Array.prototype.slice.call( arguments, 1 ) ), - strings = ( { - "time": function ( msgKeyPrefix, secondsAgo ) { - var suffix = '-second', - new_time = secondsAgo; - - if ( secondsAgo >= 604800 ) { - new_time = secondsAgo / 604800; - suffix = '-week'; - } else if ( secondsAgo >= 86400 ) { - new_time = secondsAgo / 86400; - suffix = '-day'; - } else if ( secondsAgo >= 3600 ) { - new_time = secondsAgo / 3600; - suffix = '-hour'; - } else if ( secondsAgo >= 60 ) { - new_time = secondsAgo / 60; - suffix = '-minute'; - } - - return mw.msg.call( this, msgKeyPrefix + suffix, Math.floor( new_time ) ); - }, - - "datetime": function ( timestamp ) { - return ( new Date( timestamp ) ).toLocaleString(); - } - } ), - result = strings[ str ]; - - if ( !result ) { - return mw.message( str ).params( parameters ); - } - - if ( $.isFunction( result ) ) { - // Callable; return the result of callback(arguments) - result = result.apply( strings, parameters ); - } - - // Return the result string - return { text: function () { return result; } }; - } - /** * Calls flowMessages to get localized message strings. * @todo use mw.message @@ -247,15 +191,9 @@ */ FlowHandlebars.prototype.l10n = function ( str /*, args..., options */ ) { // chop off str and options leaving just args - var args = flowNormalizeL10nParameters( Array.prototype.slice.call( arguments, 1, -1 ) ), - res = flowMessages.call( mw, str, args ).text(); + var args = flowNormalizeL10nParameters( Array.prototype.slice.call( arguments, 1, -1 ) ); - if ( !res ) { - mw.flow.debug( "[l10n] Empty String", args ); - return "(l10n:" + str + ")"; - } - - return res; + return mw.message( str ).params( args ).text(); }; /** @@ -280,51 +218,39 @@ * @param {String} [fallback] fallback string displayed when timestamp hovered over * @returns {String} */ - FlowHandlebars.prototype.uuidTimestamp = function ( uuid, str, timeAgoOnly, fallback ) { + FlowHandlebars.prototype.uuidTimestamp = function ( uuid, timeAgoOnly ) { var timestamp = parseInt( uuid, 36 ).toString( 2 ); // base-36 to base-10 to base-2 timestamp = Array( 88 + 1 - timestamp.length ).join( '0' ) + timestamp; // left pad 0 to 88 chars timestamp = parseInt( timestamp.substr( 0, 46 ), 2 ); // first 46 chars base-2 to base-10 - return FlowHandlebars.prototype.timestamp( timestamp, str, timeAgoOnly, fallback ); + return FlowHandlebars.prototype.timestamp( timestamp, timeAgoOnly ); }; /** * Generates markup for an "nnn sssss ago" and date/time string. * @example {{timestamp start_time "flow-message-x-"}} * @param {int} timestamp milliseconds - * @param {String} str a message key prefix which when combined with 'second', 'minute', 'hour', - * 'week' matches an i18n message * @param {bool} [timeAgoOnly] - * @param {str} fallback string displayed when timestamp hovered over and for posts older than a month * @returns {String|undefined} */ - FlowHandlebars.prototype.timestamp = function ( timestamp, str, timeAgoOnly, fallback ) { - if ( isNaN( timestamp ) || !str ) { + FlowHandlebars.prototype.timestamp = function ( timestamp, timeAgoOnly ) { + if ( isNaN( timestamp ) ) { mw.flow.debug( '[timestamp] Invalid arguments', arguments); return; } - var time_ago, guid, - seconds_ago = ( +new Date() - timestamp ) / 1000; + var guid, + formatter = moment( timestamp ); - if ( seconds_ago < 2419200 ) { - // Return "n ago" for only dates less than 4 weeks ago - time_ago = FlowHandlebars.prototype.l10n( 'time', str, seconds_ago, {} ); - - if ( timeAgoOnly === true ) { - // timeAgoOnly: return only this text - return time_ago; - } - } else if ( timeAgoOnly === true ) { - // timeAgoOnly: return nothing - return fallback; + if ( timeAgoOnly ) { + return formatter.fromNow(); } // Generate a GUID for this element to find it later guid = (Math.random() + 1 ).toString( 36 ).substring( 2 ); // Store this in the timestamps auto-updater array - _timestamp.list.push( { guid: guid, timestamp: timestamp, str: str, failcount: 0 } ); + _timestamp.list.push( { guid: guid, timestamp: timestamp, failcount: 0 } ); // Render the timestamp template return FlowHandlebars.prototype.html( @@ -332,8 +258,8 @@ 'timestamp', { time_iso: timestamp, - time_readable: fallback || FlowHandlebars.prototype.l10n( 'datetime', timestamp, {} ), - time_ago: time_ago, + time_ago: formatter.fromNow(), + time_readable: formatter.format( 'LLL' ), guid: guid } ) @@ -376,7 +302,7 @@ secondsAgo = currentTime - ( arrayItem.timestamp / 1000 ); if ( $ago && $ago.length ) { - text = FlowHandlebars.prototype.timestamp( arrayItem.timestamp, arrayItem.str, true ); + text = FlowHandlebars.prototype.timestamp( arrayItem.timestamp, true ); // Returned a valid "n ago" string? if ( text ) { @@ -693,4 +619,4 @@ Handlebars.registerHelper( 'plaintextSnippet', FlowHandlebars.prototype.plaintextSnippet ); Handlebars.registerHelper( 'debug', FlowHandlebars.prototype.debug ); -}( jQuery ) ); +}( jQuery, moment ) ); diff --git a/tests/qunit/engine/misc/test_flow-handlebars.js b/tests/qunit/engine/misc/test_flow-handlebars.js index 7c839ff..f66ee92 100644 --- a/tests/qunit/engine/misc/test_flow-handlebars.js +++ b/tests/qunit/engine/misc/test_flow-handlebars.js @@ -150,33 +150,4 @@ ); } ); -QUnit.test( 'FlowHandlebars.prototype.timestamp', 2, function( assert ) { - var - minutesAgo = new Date().getTime() - ( 1000 * 5 * 60 ), - agesAgo = 1008878534140, - $res = $( '<div>' ). - html( this.handlebarsProto.timestamp( minutesAgo, 'flow-started-ago', true, 'fallback' ) ), - $res2 = $( '<div>' ). - html( this.handlebarsProto.timestamp( agesAgo, 'flow-started-ago', true, 'fallback' ) ); - - assert.strictEqual( $res.text(), mw.msg( 'flow-started-ago-minute', 5 ), 'Check right message was used.' ); - assert.strictEqual( $res2.text(), 'fallback', - 'Used fallback text as this was significantly old! Caution: this test may fail if you invent a time travel machine and have travelled to December 2001.' ); -} ); - -QUnit.test( 'FlowHandlebars.prototype.l10n', 11, function( assert ) { - assert.strictEqual( this.handlebarsProto.l10n( 'time', 'flow-time-ago', 2, this.opts ), '2 seconds ago', 'Check seconds.' ); - assert.strictEqual( this.handlebarsProto.l10n( 'time', 'flow-time-ago', 120, this.opts ), '2 minutes ago', 'Check minutes.' ); - assert.strictEqual( this.handlebarsProto.l10n( 'time', 'flow-time-ago', 60 * 60 * 2, this.opts ), '2 hours ago', 'Check hour.' ); - assert.strictEqual( this.handlebarsProto.l10n( 'time', 'flow-time-ago', 60 * 60 * 24 * 2, this.opts ), '2 days ago', 'Check day.' ); - assert.strictEqual( this.handlebarsProto.l10n( 'time', 'flow-time-ago', 60 * 60 * 24 * 7 * 2, this.opts ), '2 weeks ago', 'Check week.' ); - assert.strictEqual( this.handlebarsProto.l10n( 'time', 'flow-active-ago', 60 * 60 * 24 * 7 * 2, this.opts ), 'Active 2 weeks ago', 'Check week.' ); - assert.strictEqual( this.handlebarsProto.l10n( 'time', 'flow-started-ago', 60 * 60 * 24 * 7 * 2, this.opts ), 'Started 2 weeks ago', 'Check week.' ); - assert.strictEqual( this.handlebarsProto.l10n( 'time', 'flow-edited-ago', 60 * 60 * 24 * 7 * 2, this.opts ), 'Edited 2 weeks ago', 'Check week.' ); - - assert.strictEqual( this.handlebarsProto.l10n( 'time', 'flow-active-ago', 1, this.opts ), 'Active 1 second ago', 'Check non-plural.' ); - assert.strictEqual( this.handlebarsProto.l10n( 'time', 'flow-started-ago', 60 * 60 * 24 * 7 * 1, this.opts ), 'Started 1 week ago', 'Check non-plural' ); - assert.strictEqual( this.handlebarsProto.l10n( 'time', 'flow-edited-ago', 60 * 60 * 24 * 1, this.opts ), 'Edited 1 day ago', 'Check non-plural' ); -} ); - } ( jQuery ) ); -- To view, visit https://gerrit.wikimedia.org/r/169596 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I255e3d0e3cb2dd9ee61098230ac9f234db479e66 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits