jenkins-bot has submitted this change and it was merged.
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
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
17 files changed, 95 insertions(+), 285 deletions(-)
Approvals:
Matthias Mullie: Looks good to me, approved
jenkins-bot: Verified
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 2594e1b..8812dbd 100644
--- a/Resources.php
+++ b/Resources.php
@@ -30,7 +30,10 @@
),
),
'ext.flow.templating' => $flowTemplatingResourceTemplate + array(
- 'dependencies' => 'ext.mantle.handlebars',
+ 'dependencies' => array(
+ 'ext.mantle.handlebars',
+ 'moment',
+ ),
'templates' => array(
'flow_anon_warning.handlebars',
"flow_block_board-history.handlebars",
@@ -297,28 +300,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 2e570a0..eba9a67 100644
--- a/handlebars/compiled/flow_block_topic.handlebars.php
+++ b/handlebars/compiled/flow_block_topic.handlebars.php
@@ -55,16 +55,17 @@
<a
href="'.htmlentities((string)((isset($in['actions']['reply']['url']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['url'] : null),
ENT_QUOTES, 'UTF-8').'"
title="'.htmlentities((string)((isset($in['actions']['reply']['title']) &&
is_array($in['actions']['reply'])) ? $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((string)((isset($in['actions']['reply']['title'])
&& is_array($in['actions']['reply'])) ? $in['actions']['reply']['title'] :
null), ENT_QUOTES, 'UTF-8').'</a>
+ data-flow-interactive-handler="activateForm"
+
>'.htmlentities((string)((isset($in['actions']['reply']['title']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['title'] : null),
ENT_QUOTES, 'UTF-8').'</a>
•
' : '').'
'.LCRun3::ch($cx, 'l10n',
Array(Array('flow-topic-comments',((isset($in['reply_count']) && is_array($in))
? $in['reply_count'] : null)),Array()), 'encq').' •
'.((LCRun3::ifvar($cx, ((isset($in['last_updated']) && is_array($in)) ?
$in['last_updated'] : null))) ? '
- '.LCRun3::ch($cx, 'timestamp',
Array(Array(((isset($in['last_updated']) && is_array($in)) ?
$in['last_updated'] :
null),'flow-active-ago',false,((isset($in['last_updated_readable']) &&
is_array($in)) ? $in['last_updated_readable'] : null)),Array()), 'encq').'
+ '.LCRun3::ch($cx, 'timestamp',
Array(Array(((isset($in['last_updated']) && is_array($in)) ?
$in['last_updated'] : null)),Array()), 'encq').'
' : '
- '.LCRun3::ch($cx, 'uuidTimestamp',
Array(Array(((isset($in['postId']) && is_array($in)) ? $in['postId'] :
null),'flow-started-ago',false),Array()), 'encq').'
+ '.LCRun3::ch($cx, 'uuidTimestamp',
Array(Array(((isset($in['postId']) && is_array($in)) ? $in['postId'] :
null)),Array()), 'encq').'
').'
</div>
'.((LCRun3::ifvar($cx, ((isset($in['isModerated']) && is_array($in)) ?
$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 fb12bb5..242fd30 100644
--- a/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
@@ -109,13 +109,13 @@
class="mw-ui-anchor mw-ui-progressive mw-ui-quiet"
title="'.htmlentities((string)((isset($in['links']['diff-prev']['title']) &&
is_array($in['links']['diff-prev'])) ? $in['links']['diff-prev']['title'] :
null), ENT_QUOTES, 'UTF-8').'">
' : '').'
- '.LCRun3::ch($cx, 'uuidTimestamp',
Array(Array(((isset($in['revisionId']) && is_array($in)) ? $in['revisionId'] :
null),'flow-edited-ago','1'),Array()), 'encq').'
+ '.LCRun3::ch($cx, 'uuidTimestamp',
Array(Array(((isset($in['revisionId']) && is_array($in)) ? $in['revisionId'] :
null),true),Array()), 'encq').'
'.((LCRun3::ifvar($cx, ((isset($in['links']['diff-prev']) &&
is_array($in['links'])) ? $in['links']['diff-prev'] : null))) ? '
</a>
' : '').'
•
' : '').'
- '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((isset($in['postId'])
&& is_array($in)) ? $in['postId'] :
null),'flow-time-ago','0',((isset($in['timestamp_readable']) && is_array($in))
? $in['timestamp_readable'] : null)),Array()), 'encq').'
+ '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((isset($in['postId'])
&& is_array($in)) ? $in['postId'] : null)),Array()), 'encq').'
</div>
';},'flow_moderation_actions_list' => function ($cx, $in) {return
''.LCRun3::hbch($cx, 'ifCond', Array(Array(((isset($in['moderationType']) &&
is_array($in)) ? $in['moderationType'] : null),'===','topic'),Array()), $in,
function($cx, $in) {return '
'.((LCRun3::ifvar($cx, ((isset($in['actions']['edit']) &&
is_array($in['actions'])) ? $in['actions']['edit'] : null))) ? '<li
class="'.htmlentities((string)((isset($in['moderationContainerClass']) &&
is_array($in)) ? $in['moderationContainerClass'] : null), ENT_QUOTES,
'UTF-8').'-edit-action">'.htmlentities((string)((isset($in['null']) &&
is_array($in)) ? $in['null'] : null), ENT_QUOTES, 'UTF-8').'<a
class="'.htmlentities((string)((isset($in['moderationMwUiClass']) &&
is_array($in)) ? $in['moderationMwUiClass'] : null), ENT_QUOTES, 'UTF-8').'
mw-ui-quiet"
diff --git a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
index f6b2c9b..d7f81bf 100644
--- a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
@@ -109,13 +109,13 @@
class="mw-ui-anchor mw-ui-progressive mw-ui-quiet"
title="'.htmlentities((string)((isset($in['links']['diff-prev']['title']) &&
is_array($in['links']['diff-prev'])) ? $in['links']['diff-prev']['title'] :
null), ENT_QUOTES, 'UTF-8').'">
' : '').'
- '.LCRun3::ch($cx, 'uuidTimestamp',
Array(Array(((isset($in['revisionId']) && is_array($in)) ? $in['revisionId'] :
null),'flow-edited-ago','1'),Array()), 'encq').'
+ '.LCRun3::ch($cx, 'uuidTimestamp',
Array(Array(((isset($in['revisionId']) && is_array($in)) ? $in['revisionId'] :
null),true),Array()), 'encq').'
'.((LCRun3::ifvar($cx, ((isset($in['links']['diff-prev']) &&
is_array($in['links'])) ? $in['links']['diff-prev'] : null))) ? '
</a>
' : '').'
•
' : '').'
- '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((isset($in['postId'])
&& is_array($in)) ? $in['postId'] :
null),'flow-time-ago','0',((isset($in['timestamp_readable']) && is_array($in))
? $in['timestamp_readable'] : null)),Array()), 'encq').'
+ '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((isset($in['postId'])
&& is_array($in)) ? $in['postId'] : null)),Array()), 'encq').'
</div>
';},'flow_moderation_actions_list' => function ($cx, $in) {return
''.LCRun3::hbch($cx, 'ifCond', Array(Array(((isset($in['moderationType']) &&
is_array($in)) ? $in['moderationType'] : null),'===','topic'),Array()), $in,
function($cx, $in) {return '
'.((LCRun3::ifvar($cx, ((isset($in['actions']['edit']) &&
is_array($in['actions'])) ? $in['actions']['edit'] : null))) ? '<li
class="'.htmlentities((string)((isset($in['moderationContainerClass']) &&
is_array($in)) ? $in['moderationContainerClass'] : null), ENT_QUOTES,
'UTF-8').'-edit-action">'.htmlentities((string)((isset($in['null']) &&
is_array($in)) ? $in['null'] : null), ENT_QUOTES, 'UTF-8').'<a
class="'.htmlentities((string)((isset($in['moderationMwUiClass']) &&
is_array($in)) ? $in['moderationMwUiClass'] : null), ENT_QUOTES, 'UTF-8').'
mw-ui-quiet"
diff --git a/handlebars/compiled/flow_block_topiclist.handlebars.php
b/handlebars/compiled/flow_block_topiclist.handlebars.php
index bf2918a..254685f 100644
--- a/handlebars/compiled/flow_block_topiclist.handlebars.php
+++ b/handlebars/compiled/flow_block_topiclist.handlebars.php
@@ -159,16 +159,17 @@
<a
href="'.htmlentities((string)((isset($in['actions']['reply']['url']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['url'] : null),
ENT_QUOTES, 'UTF-8').'"
title="'.htmlentities((string)((isset($in['actions']['reply']['title']) &&
is_array($in['actions']['reply'])) ? $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((string)((isset($in['actions']['reply']['title'])
&& is_array($in['actions']['reply'])) ? $in['actions']['reply']['title'] :
null), ENT_QUOTES, 'UTF-8').'</a>
+ data-flow-interactive-handler="activateForm"
+
>'.htmlentities((string)((isset($in['actions']['reply']['title']) &&
is_array($in['actions']['reply'])) ? $in['actions']['reply']['title'] : null),
ENT_QUOTES, 'UTF-8').'</a>
•
' : '').'
'.LCRun3::ch($cx, 'l10n',
Array(Array('flow-topic-comments',((isset($in['reply_count']) && is_array($in))
? $in['reply_count'] : null)),Array()), 'encq').' •
'.((LCRun3::ifvar($cx, ((isset($in['last_updated']) && is_array($in)) ?
$in['last_updated'] : null))) ? '
- '.LCRun3::ch($cx, 'timestamp',
Array(Array(((isset($in['last_updated']) && is_array($in)) ?
$in['last_updated'] :
null),'flow-active-ago',false,((isset($in['last_updated_readable']) &&
is_array($in)) ? $in['last_updated_readable'] : null)),Array()), 'encq').'
+ '.LCRun3::ch($cx, 'timestamp',
Array(Array(((isset($in['last_updated']) && is_array($in)) ?
$in['last_updated'] : null)),Array()), 'encq').'
' : '
- '.LCRun3::ch($cx, 'uuidTimestamp',
Array(Array(((isset($in['postId']) && is_array($in)) ? $in['postId'] :
null),'flow-started-ago',false),Array()), 'encq').'
+ '.LCRun3::ch($cx, 'uuidTimestamp',
Array(Array(((isset($in['postId']) && is_array($in)) ? $in['postId'] :
null)),Array()), 'encq').'
').'
</div>
'.((LCRun3::ifvar($cx, ((isset($in['isModerated']) && is_array($in)) ?
$in['isModerated'] : null))) ? '
@@ -411,4 +412,4 @@
</div>
';
}
-?>
+?>
\ No newline at end of file
diff --git a/handlebars/compiled/flow_post.handlebars.php
b/handlebars/compiled/flow_post.handlebars.php
index 7f8eb31..1955451 100644
--- a/handlebars/compiled/flow_post.handlebars.php
+++ b/handlebars/compiled/flow_post.handlebars.php
@@ -87,13 +87,13 @@
class="mw-ui-anchor mw-ui-progressive mw-ui-quiet"
title="'.htmlentities((string)((isset($in['links']['diff-prev']['title']) &&
is_array($in['links']['diff-prev'])) ? $in['links']['diff-prev']['title'] :
null), ENT_QUOTES, 'UTF-8').'">
' : '').'
- '.LCRun3::ch($cx, 'uuidTimestamp',
Array(Array(((isset($in['revisionId']) && is_array($in)) ? $in['revisionId'] :
null),'flow-edited-ago','1'),Array()), 'encq').'
+ '.LCRun3::ch($cx, 'uuidTimestamp',
Array(Array(((isset($in['revisionId']) && is_array($in)) ? $in['revisionId'] :
null),true),Array()), 'encq').'
'.((LCRun3::ifvar($cx, ((isset($in['links']['diff-prev']) &&
is_array($in['links'])) ? $in['links']['diff-prev'] : null))) ? '
</a>
' : '').'
•
' : '').'
- '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((isset($in['postId'])
&& is_array($in)) ? $in['postId'] :
null),'flow-time-ago','0',((isset($in['timestamp_readable']) && is_array($in))
? $in['timestamp_readable'] : null)),Array()), 'encq').'
+ '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((isset($in['postId'])
&& is_array($in)) ? $in['postId'] : null)),Array()), 'encq').'
</div>
';},'flow_moderation_actions_list' => function ($cx, $in) {return
''.LCRun3::hbch($cx, 'ifCond', Array(Array(((isset($in['moderationType']) &&
is_array($in)) ? $in['moderationType'] : null),'===','topic'),Array()), $in,
function($cx, $in) {return '
'.((LCRun3::ifvar($cx, ((isset($in['actions']['edit']) &&
is_array($in['actions'])) ? $in['actions']['edit'] : null))) ? '<li
class="'.htmlentities((string)((isset($in['moderationContainerClass']) &&
is_array($in)) ? $in['moderationContainerClass'] : null), ENT_QUOTES,
'UTF-8').'-edit-action">'.htmlentities((string)((isset($in['null']) &&
is_array($in)) ? $in['null'] : null), ENT_QUOTES, 'UTF-8').'<a
class="'.htmlentities((string)((isset($in['moderationMwUiClass']) &&
is_array($in)) ? $in['moderationMwUiClass'] : null), ENT_QUOTES, 'UTF-8').'
mw-ui-quiet"
diff --git a/handlebars/compiled/timestamp.handlebars.php
b/handlebars/compiled/timestamp.handlebars.php
index 5563b13..fd91f59 100644
--- a/handlebars/compiled/timestamp.handlebars.php
+++ b/handlebars/compiled/timestamp.handlebars.php
@@ -18,18 +18,18 @@
'sp_vars' => Array(),
);
- return ''.((LCRun3::ifvar($cx, ((isset($in['time_ago']) && is_array($in))
? $in['time_ago'] : null))) ? '
- '.((LCRun3::ifvar($cx, ((isset($in['guid']) && is_array($in)) ?
$in['guid'] : null))) ? '
- <time datetime="'.htmlentities((string)((isset($in['time_iso'])
&& is_array($in)) ? $in['time_iso'] : null), ENT_QUOTES, 'UTF-8').'"
class="flow-timestamp">
- <span
class="flow-timestamp-now">'.htmlentities((string)((isset($in['time_readable'])
&& is_array($in)) ? $in['time_readable'] : null), ENT_QUOTES, 'UTF-8').'</span>
- <span id="'.htmlentities((string)((isset($in['guid'])
&& is_array($in)) ? $in['guid'] : null), ENT_QUOTES, 'UTF-8').'"
class="flow-timestamp-ago">'.htmlentities((string)((isset($in['time_ago']) &&
is_array($in)) ? $in['time_ago'] : null), ENT_QUOTES, 'UTF-8').'</span>
- </time>
- ' : '
- <time datetime="'.htmlentities((string)((isset($in['time_iso'])
&& is_array($in)) ? $in['time_iso'] : null), ENT_QUOTES, 'UTF-8').'"
class="flow-timestamp flow-load-interactive" data-flow-load-handler="timestamp"
data-time-str="'.htmlentities((string)((isset($in['time_str']) &&
is_array($in)) ? $in['time_str'] : null), ENT_QUOTES, 'UTF-8').'"
data-time-ago-only="'.htmlentities((string)((isset($in['time_ago_only']) &&
is_array($in)) ? $in['time_ago_only'] : null), ENT_QUOTES,
'UTF-8').'">'.htmlentities((string)((isset($in['time_readable']) &&
is_array($in)) ? $in['time_readable'] : null), ENT_QUOTES, 'UTF-8').'</time>
- ').'
+ return ''.((LCRun3::ifvar($cx, ((isset($in['guid']) && is_array($in)) ?
$in['guid'] : null))) ? '
+ <time datetime="'.htmlentities((string)((isset($in['time_iso']) &&
is_array($in)) ? $in['time_iso'] : null), ENT_QUOTES, 'UTF-8').'"
class="flow-timestamp">
' : '
- <time datetime="'.htmlentities((string)((isset($in['time_iso']) &&
is_array($in)) ? $in['time_iso'] : null), ENT_QUOTES, 'UTF-8').'"
class="flow-timestamp">'.htmlentities((string)((isset($in['time_readable']) &&
is_array($in)) ? $in['time_readable'] : null), ENT_QUOTES, 'UTF-8').'</time>
+ <time datetime="'.htmlentities((string)((isset($in['time_iso']) &&
is_array($in)) ? $in['time_iso'] : null), ENT_QUOTES, 'UTF-8').'"
+ class="flow-timestamp flow-load-interactive"
+ data-flow-load-handler="timestamp"
+
data-time-ago-only="'.htmlentities((string)((isset($in['time_ago_only']) &&
is_array($in)) ? $in['time_ago_only'] : null), ENT_QUOTES, 'UTF-8').'"
+ >
').'
+ <span
class="flow-timestamp-now">'.htmlentities((string)((isset($in['time_readable'])
&& is_array($in)) ? $in['time_readable'] : null), ENT_QUOTES, 'UTF-8').'</span>
+ <span id="'.htmlentities((string)((isset($in['guid']) && is_array($in))
? $in['guid'] : null), ENT_QUOTES, 'UTF-8').'"
class="flow-timestamp-ago">'.htmlentities((string)((isset($in['time_ago']) &&
is_array($in)) ? $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 1ff7700..5036df7 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/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 247b4f5..bc6bd5d 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -348,18 +348,6 @@
"flow-topic-first-heading": "Topic on $1",
"flow-topic-html-title": "$1 on $2",
"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 ",
@@ -387,16 +375,6 @@
"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",
"flow-post-undo-hide": "(undo hide)",
"flow-post-undo-delete": "(undo delete)",
"flow-post-undo-suppress": "(undo suppress)",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 4526983..8ff7a0d 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -352,18 +352,6 @@
"flow-topic-first-heading": "First heading on any page in the topic
namespace. Parameters:\n* $1 - the title of the page that is being linked to",
"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": "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",
@@ -391,16 +379,6 @@
"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}}",
"flow-post-undo-hide": "Automatic moderation summary when undoing a
hide that was just performed.",
"flow-post-undo-delete": "Automatic moderation summary when undoing a
delete that was just performed.",
"flow-post-undo-suppress": "Automatic moderation summary when undoing a
suppress that was just performed.",
diff --git a/includes/TemplateHelper.php b/includes/TemplateHelper.php
index 5de7dd2..4c7595a 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;
@@ -193,41 +194,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
@@ -235,12 +201,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 ) {
@@ -249,7 +214,7 @@
// timestamp helper expects ms timestamp
$timestamp = $obj->getTimestampObj()->getTimestamp() * 1000;
- return self::timestamp( $timestamp, $str, $timeAgoOnly );
+ return self::timestamp( $timestamp, $timeAgoOnly );
}
/**
@@ -259,42 +224,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
)
) );
@@ -554,7 +520,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 6c9d49e..6ecf9d0 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();
};
/**
@@ -274,57 +212,42 @@
* Parses the timestamp out of a base-36 UUID, and calls timestamp with
it.
* @example {{uuidTimestamp id "flow-message-x-"}}
* @param {String} uuid id
- * @param {String} str a message key prefix which when combined with
'second', 'minute', 'hour',
- * 'week' matches an i18n message
* @param {bool} [timeAgoOnly]
- * @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 +255,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 +299,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 ) {
@@ -702,4 +625,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 caf9638..cc0f70f 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: merged
Gerrit-Change-Id: I255e3d0e3cb2dd9ee61098230ac9f234db479e66
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits