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 it = this.get('notification');
|
||||||
const badgeId = it.get("data.badge_id");
|
const badgeId = it.get("data.badge_id");
|
||||||
if (badgeId) {
|
if (badgeId) {
|
||||||
|
var badgeSlug = it.get("data.badge_slug");
|
||||||
|
|
||||||
|
if (!badgeSlug) {
|
||||||
const badgeName = it.get("data.badge_name");
|
const badgeName = it.get("data.badge_name");
|
||||||
return Discourse.getURL('/badges/' + badgeId + '/' + badgeName.replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase());
|
badgeSlug = badgeName.replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Discourse.getURL('/badges/' + badgeId + '/' + badgeSlug);
|
||||||
}
|
}
|
||||||
|
|
||||||
const topicId = it.get('topic_id');
|
const topicId = it.get('topic_id');
|
||||||
|
|
|
@ -44,7 +44,7 @@ class BadgeGranter
|
||||||
I18n.with_locale(@user.effective_locale) do
|
I18n.with_locale(@user.effective_locale) do
|
||||||
notification = @user.notifications.create(
|
notification = @user.notifications.create(
|
||||||
notification_type: Notification.types[:granted_badge],
|
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
|
user_badge.update_attributes notification_id: notification.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue