FIX: Fix badge count of other users. (#6016)

Don't count the current user in "Others with this badge".
This commit is contained in:
Misaka 0x4e21 2018-07-02 15:34:09 +08:00 committed by Guo Xiang Tan
parent 969e79d7c6
commit cb86c5ae1e
2 changed files with 6 additions and 1 deletions

View File

@ -28,6 +28,11 @@ export default Ember.Controller.extend(BadgeSelectController, {
return username ? userCount : modelCount;
},
@computed("model.grant_count", "userBadges.grant_count")
othersCount(modelCount, userCount) {
return modelCount - userCount;
},
@computed("model.allow_title", "model.has_badge", "model")
canSelectTitle(hasTitleBadges, hasBadge) {
return this.siteSettings.enable_badges && hasTitleBadges && hasBadge;

View File

@ -52,7 +52,7 @@
{{#unless canLoadMore}}
{{#if canShowOthers}}
<div class='clearfix'>
<a class='btn' href='{{model.url}}'>{{i18n 'badges.others_count' count=model.grant_count}}</a>
<a class='btn' href='{{model.url}}'>{{i18n 'badges.others_count' count=othersCount}}</a>
</div>
{{/if}}
{{/unless}}