mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:47:22 +08:00
FIX: Use correct badge slug within notifications
This commit is contained in:
parent
25e9aa7653
commit
445bd033d2
|
@ -22,8 +22,14 @@ export default Ember.Component.extend({
|
|||
const it = this.get('notification');
|
||||
const badgeId = it.get("data.badge_id");
|
||||
if (badgeId) {
|
||||
const badgeName = it.get("data.badge_name");
|
||||
return Discourse.getURL('/badges/' + badgeId + '/' + badgeName.replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase());
|
||||
var badgeSlug = it.get("data.badge_slug");
|
||||
|
||||
if (!badgeSlug) {
|
||||
const badgeName = it.get("data.badge_name");
|
||||
badgeSlug = badgeName.replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase();
|
||||
}
|
||||
|
||||
return Discourse.getURL('/badges/' + badgeId + '/' + badgeSlug);
|
||||
}
|
||||
|
||||
const topicId = it.get('topic_id');
|
||||
|
|
|
@ -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 }.to_json)
|
||||
data: { badge_id: @badge.id, badge_name: @badge.display_name, badge_slug: @badge.slug }.to_json)
|
||||
user_badge.update_attributes notification_id: notification.id
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user