diff --git a/app/assets/javascripts/discourse/components/notification-item.js.es6 b/app/assets/javascripts/discourse/components/notification-item.js.es6 index 66520e002fe..8eef09c0c85 100644 --- a/app/assets/javascripts/discourse/components/notification-item.js.es6 +++ b/app/assets/javascripts/discourse/components/notification-item.js.es6 @@ -29,7 +29,9 @@ export default Ember.Component.extend({ badgeSlug = badgeName.replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase(); } - return Discourse.getURL('/badges/' + badgeId + '/' + badgeSlug); + var username = it.get('data.username'); + username = username ? "?username=" + username.toLowerCase() : ""; + return Discourse.getURL('/badges/' + badgeId + '/' + badgeSlug + username); } const topicId = it.get('topic_id'); diff --git a/app/services/badge_granter.rb b/app/services/badge_granter.rb index b6d964a6556..7e237703d22 100644 --- a/app/services/badge_granter.rb +++ b/app/services/badge_granter.rb @@ -44,7 +44,7 @@ class BadgeGranter I18n.with_locale(@user.effective_locale) do notification = @user.notifications.create( notification_type: Notification.types[:granted_badge], - data: { badge_id: @badge.id, badge_name: @badge.display_name, badge_slug: @badge.slug }.to_json) + data: { badge_id: @badge.id, badge_name: @badge.display_name, badge_slug: @badge.slug, username: @user.username}.to_json) user_badge.update_attributes notification_id: notification.id end end