hide bookmarks count in user summary except for yourself

This commit is contained in:
Régis Hanol 2016-05-09 15:51:43 +02:00
parent f7e552e131
commit 03605f1b01
3 changed files with 11 additions and 1 deletions

View file

@ -8,7 +8,9 @@
</li>
<li>{{user-stat value=model.posts_read_count label="user.summary.posts_read"}}</li>
<li>{{user-stat value=model.likes_given label="user.summary.likes_given"}}</li>
<li>{{user-stat value=model.bookmark_count label="user.summary.bookmark_count"}}</li>
{{#if model.bookmark_count}}
<li>{{user-stat value=model.bookmark_count label="user.summary.bookmark_count"}}</li>
{{/if}}
<li>{{user-stat value=model.topic_count label="user.summary.topic_count"}}</li>
<li>{{user-stat value=model.post_count label="user.summary.post_count"}}</li>
<li>{{user-stat value=model.likes_received label="user.summary.likes_received"}}</li>

View file

@ -136,6 +136,10 @@ class UserSummary
@user.featured_user_badges(MAX_BADGES)
end
def user_id
@user.id
end
def user_stat
@user.user_stat
end

View file

@ -43,6 +43,10 @@ class UserSummarySerializer < ApplicationSerializer
SiteSetting.enable_badges
end
def include_bookmark_count?
scope.authenticated? && object.user_id == scope.user.id
end
def time_read
AgeWords.age_words(object.time_read)
end