FEATURE: show read time on user cards

This commit is contained in:
Neil Lalonde 2017-11-08 15:25:56 -05:00
parent 3940e95227
commit 2aadc42662
3 changed files with 7 additions and 0 deletions
app
assets/javascripts/discourse/templates/components
serializers
config/locales

View File

@ -118,6 +118,7 @@
<h3><span class='desc'>{{i18n 'last_post'}}</span> {{format-date user.last_posted_at leaveAgo="true"}}</h3>
{{/if}}
<h3><span class='desc'>{{i18n 'joined'}}</span> {{format-date user.created_at leaveAgo="true"}}</h3>
<h3><span class='desc'>{{i18n 'time_read'}}</span> {{user.time_read}}</h3>
{{plugin-outlet name="user-card-metadata" args=(hash user=user)}}
</div>
{{/if}}

View File

@ -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

View File

@ -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