FIX: don't show badges in summary page if badges disabled

This commit is contained in:
Sam 2016-03-29 17:11:47 +11:00
parent 24630f6b54
commit adbc22530c
2 changed files with 11 additions and 5 deletions

View File

@ -410,11 +410,13 @@ const User = RestModel.extend({
summary.topics = summary.topic_ids.map(id => topicMap[id]); summary.topics = summary.topic_ids.map(id => topicMap[id]);
if (summary.badges) {
summary.badges = summary.badges.map(ub => { summary.badges = summary.badges.map(ub => {
const badge = badgeMap[ub.badge_id]; const badge = badgeMap[ub.badge_id];
badge.count = ub.count; badge.count = ub.count;
return badge; return badge;
}); });
}
return summary; return summary;
}); });
} }

View File

@ -15,4 +15,8 @@ class UserSummarySerializer < ApplicationSerializer
attributes :likes_given, :likes_received, :posts_read_count, attributes :likes_given, :likes_received, :posts_read_count,
:days_visited, :topic_count, :post_count :days_visited, :topic_count, :post_count
def include_badges?
SiteSetting.enable_badges
end
end end