From 8f5d3a5cbd306823d780b5ec59ea55395616f360 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 9 Jun 2016 11:26:07 +0800 Subject: [PATCH] UX: Use relative age for logs notice instead. --- app/assets/javascripts/discourse/services/logs-notice.js.es6 | 5 +++-- config/locales/client.en.yml | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/services/logs-notice.js.es6 b/app/assets/javascripts/discourse/services/logs-notice.js.es6 index 07ad6acd037..10d4b01ec48 100644 --- a/app/assets/javascripts/discourse/services/logs-notice.js.es6 +++ b/app/assets/javascripts/discourse/services/logs-notice.js.es6 @@ -1,5 +1,5 @@ -import { on, observes } from 'ember-addons/ember-computed-decorators'; -import computed from 'ember-addons/ember-computed-decorators'; +import { default as computed, on, observes } from 'ember-addons/ember-computed-decorators'; +import { autoUpdatingRelativeAge } from 'discourse/lib/formatter'; const LOGS_NOTICE_KEY = "logs-notice-text"; @@ -28,6 +28,7 @@ const LogsNotice = Ember.Object.extend({ this.set('text', I18n.t(`logs_error_rate_notice.${translationKey}`, { + relativeAge: autoUpdatingRelativeAge(new Date), timestamp: moment().format("YYYY-MM-DD H:mm:ss"), siteSettingRate: I18n.t('logs_error_rate_notice.rate', { count: siteSettingLimit, duration: duration }), rate: I18n.t('logs_error_rate_notice.rate', { count: rate, duration: duration }), diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 24c602ed069..b7647e2b713 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -842,8 +842,8 @@ en: too_few_topics_notice: "Let's get this discussion started! There are currently %{currentTopics} / %{requiredTopics} topics. New visitors need some conversations to read and respond to." too_few_posts_notice: "Let's get this discussion started! There are currently %{currentPosts} / %{requiredPosts} posts. New visitors need some conversations to read and respond to." logs_error_rate_notice: - reached: "%{timestamp}: Current rate of %{rate} has reached site settings's limit of %{siteSettingRate}." - exceeded: "%{timestamp}: Current rate of %{rate} has exceeded site settings's limit of %{siteSettingRate}." + reached: "[%{relativeAge}] Current rate of %{rate} has reached site settings's limit of %{siteSettingRate}." + exceeded: "[%{relativeAge}] Current rate of %{rate} has exceeded site settings's limit of %{siteSettingRate}." rate: one: "1 error/%{duration}" other: "%{count} errors/%{duration}"