From 2aadc42662dff605fd2a5eec0a849a3748ac4190 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Wed, 8 Nov 2017 15:25:56 -0500 Subject: [PATCH] FEATURE: show read time on user cards --- .../discourse/templates/components/user-card-contents.hbs | 1 + app/serializers/user_serializer.rb | 5 +++++ config/locales/client.en.yml | 1 + 3 files changed, 7 insertions(+) diff --git a/app/assets/javascripts/discourse/templates/components/user-card-contents.hbs b/app/assets/javascripts/discourse/templates/components/user-card-contents.hbs index 55190fb27f6..48e10c6dcb7 100644 --- a/app/assets/javascripts/discourse/templates/components/user-card-contents.hbs +++ b/app/assets/javascripts/discourse/templates/components/user-card-contents.hbs @@ -118,6 +118,7 @@

{{i18n 'last_post'}} {{format-date user.last_posted_at leaveAgo="true"}}

{{/if}}

{{i18n 'joined'}} {{format-date user.created_at leaveAgo="true"}}

+

{{i18n 'time_read'}} {{user.time_read}}

{{plugin-outlet name="user-card-metadata" args=(hash user=user)}} {{/if}} diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb index 9f3356f2d47..895a7a39a5a 100644 --- a/app/serializers/user_serializer.rb +++ b/app/serializers/user_serializer.rb @@ -66,6 +66,7 @@ class UserSerializer < BasicUserSerializer :topic_post_count, :pending_count, :profile_view_count, + :time_read, :primary_group_name, :primary_group_flair_url, :primary_group_flair_bg_color, @@ -401,4 +402,8 @@ class UserSerializer < BasicUserSerializer object.user_profile.views end + def time_read + AgeWords.age_words(object.user_stat&.time_read) + end + end diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 8e9025d6a6a..e75296f8f9d 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1003,6 +1003,7 @@ en: mute: Mute unmute: Unmute last_post: Last post + time_read: Read time last_reply_lowercase: last reply replies_lowercase: one: reply