FEATURE: link to filtered badge list from notification

When notified on a badge link to the badge page filtered on username
This commit is contained in:
Sam 2016-01-18 18:20:16 +11:00
parent ca3e2b4da3
commit e6c1f1db52
2 changed files with 4 additions and 2 deletions

View File

@ -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');

View File

@ -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