diff --git a/app/assets/javascripts/discourse/widgets/notification-item.js.es6 b/app/assets/javascripts/discourse/widgets/notification-item.js.es6 index 5b130fc4f57..f152403ee6d 100644 --- a/app/assets/javascripts/discourse/widgets/notification-item.js.es6 +++ b/app/assets/javascripts/discourse/widgets/notification-item.js.es6 @@ -58,14 +58,9 @@ createWidget('notification-item', { return Ember.isEmpty(title) ? "" : Discourse.Utilities.escapeExpression(title); }, - text() { - const attrs = this.attrs; + text(notificationType, notName) { + const { attrs } = this; const data = attrs.data; - - const notificationType = attrs.notification_type; - - const lookup = this.site.get('notificationLookup'); - const notName = lookup[notificationType]; const scope = (notName === 'custom') ? data.message : `notifications.${notName}`; if (notificationType === GROUP_SUMMARY_TYPE) { @@ -89,10 +84,15 @@ createWidget('notification-item', { return I18n.t(scope, {description, username}); }, - html() { - const contents = new RawHtml({ html: `
${Discourse.Emoji.unescape(this.text())}
` }); - const url = this.url(); - return url ? h('a', { attributes: { href: url, 'data-auto-route': true } }, contents) : contents; + html(attrs) { + const notificationType = attrs.notification_type; + const lookup = this.site.get('notificationLookup'); + const notName = lookup[notificationType]; + + const contents = new RawHtml({ html: `
${Discourse.Emoji.unescape(this.text(notificationType, notName))}
` }); + const href = this.url(); + const alt = I18n.t(`notifications.alt.${notName}`); + return href ? h('a', { attributes: { href, alt } }, contents) : contents; }, click(e) {