From 60693240e1b8d01ff101e3893430317efafed407 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 3 May 2017 17:58:45 -0400 Subject: [PATCH] FIX: Filter badges to user on their badges page too --- .../javascripts/discourse/components/badge-card.js.es6 | 8 +++++--- .../javascripts/discourse/templates/badges/index.hbs | 2 +- .../javascripts/discourse/templates/user/badges.hbs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/components/badge-card.js.es6 b/app/assets/javascripts/discourse/components/badge-card.js.es6 index e0b2a8ab5d9..641511ae5ed 100644 --- a/app/assets/javascripts/discourse/components/badge-card.js.es6 +++ b/app/assets/javascripts/discourse/components/badge-card.js.es6 @@ -5,9 +5,11 @@ export default Ember.Component.extend({ size: 'medium', classNameBindings: [':badge-card', 'size', 'badge.slug'], - @computed('badge.url', 'badge.has_badge') - url(url, hasBadge) { - return hasBadge ? `${url}?username=${this.currentUser.get('username_lower')}` : url; + @computed('badge.url', 'filterUser') + url(badgeUrl, filterUser) { + return (filterUser) ? + `${badgeUrl}?username=${this.currentUser.get('username_lower')}` : + badgeUrl; }, @computed('count', 'badge.grant_count') diff --git a/app/assets/javascripts/discourse/templates/badges/index.hbs b/app/assets/javascripts/discourse/templates/badges/index.hbs index 08b7c79b5e2..1c211cf2ade 100644 --- a/app/assets/javascripts/discourse/templates/badges/index.hbs +++ b/app/assets/javascripts/discourse/templates/badges/index.hbs @@ -10,7 +10,7 @@ {{#each bg.badges as |b|}} - {{badge-card badge=b}} + {{badge-card badge=b filterUser=b.has_badge}} {{/each}} {{/each}} diff --git a/app/assets/javascripts/discourse/templates/user/badges.hbs b/app/assets/javascripts/discourse/templates/user/badges.hbs index 03210567ce3..458525bd299 100644 --- a/app/assets/javascripts/discourse/templates/user/badges.hbs +++ b/app/assets/javascripts/discourse/templates/user/badges.hbs @@ -1,5 +1,5 @@ {{#d-section pageClass="user-badges" class="user-content user-badges-list"}} {{#each sortedBadges as |ub|}} - {{badge-card badge=ub.badge count=ub.count username=username}} + {{badge-card badge=ub.badge count=ub.count username=username filterUser="true"}} {{/each}} {{/d-section}}