diff --git a/app/assets/javascripts/discourse-common/lib/icon-library.js.es6 b/app/assets/javascripts/discourse-common/lib/icon-library.js.es6 index fcf3ce404e6..5bf0d55a1b0 100644 --- a/app/assets/javascripts/discourse-common/lib/icon-library.js.es6 +++ b/app/assets/javascripts/discourse-common/lib/icon-library.js.es6 @@ -9,8 +9,28 @@ const REPLACEMENTS = { 'd-watching-first': 'dot-circle-o', 'd-drop-expanded': 'caret-down', 'd-drop-collapsed': 'caret-right', + 'notification.mentioned': "at", + 'notification.group_mentioned': "at", + 'notification.quoted': "quote-right", + 'notification.replied': "reply", + 'notification.posted': "reply", + 'notification.edited': "pencil", + 'notification.liked': "heart", + 'notification.liked_2': "heart", + 'notification.liked_many': "heart", + 'notification.private_message': "envelope-o", + 'notification.invited_to_private_message': "envelope-o", + 'notification.invited_to_topic': "hand-o-right", + 'notification.invitee_accepted': "user", + 'notification.moved_post': "sign-out", + 'notification.linked': "link", + 'notification.granted_badge': "certificate", + 'notification.topic_reminder': "hand-o-right", + 'notification.watching_first_post': "dot-circle-o", + 'notification.group_message_summary': "group" }; + export function renderIcon(renderType, id, params) { for (let i=0; i<_renderers.length; i++) { let renderer = _renderers[i]; diff --git a/app/assets/javascripts/discourse/widgets/notification-item.js.es6 b/app/assets/javascripts/discourse/widgets/notification-item.js.es6 index 55ce637d500..08b38446ec9 100644 --- a/app/assets/javascripts/discourse/widgets/notification-item.js.es6 +++ b/app/assets/javascripts/discourse/widgets/notification-item.js.es6 @@ -7,6 +7,7 @@ import { emojiUnescape } from 'discourse/lib/text'; import { postUrl, escapeExpression } from 'discourse/lib/utilities'; import { setTransientHeader } from 'discourse/lib/ajax'; import { userPath } from 'discourse/lib/url'; +import { iconNode } from 'discourse-common/lib/icon-library'; const LIKED_TYPE = 5; const INVITED_TYPE = 8; @@ -98,10 +99,14 @@ createWidget('notification-item', { const lookup = this.site.get('notificationLookup'); const notName = lookup[notificationType]; - const contents = new RawHtml({ html: `
${emojiUnescape(this.text(notificationType, notName))}
` }); + let title = I18n.t(`notifications.alt.${notName}`); + let icon = iconNode(`notification.${notName}`, { title }); + let text = emojiUnescape(this.text(notificationType, notName)); + let html = new RawHtml({ html: `

${text}

` }); + let contents = [ icon, html ]; + const href = this.url(); - const alt = I18n.t(`notifications.alt.${notName}`); - return href ? h('a', { attributes: { href, alt, 'data-auto-route': true } }, contents) : contents; + return href ? h('a', { attributes: { href, title, 'data-auto-route': true } }, contents) : contents; }, click(e) { diff --git a/app/assets/javascripts/discourse/widgets/user-notifications.js.es6 b/app/assets/javascripts/discourse/widgets/user-notifications.js.es6 index 7eaac6f085e..c7570479cc9 100644 --- a/app/assets/javascripts/discourse/widgets/user-notifications.js.es6 +++ b/app/assets/javascripts/discourse/widgets/user-notifications.js.es6 @@ -74,7 +74,8 @@ export default createWidget('user-notifications', { const href = `${attrs.path}/notifications`; items.push( - h('li.read.last.heading', h('a', { attributes: { href } }, [I18n.t('notifications.more'), '...'])), + h('li.read.last.heading', + h('a', { attributes: { href } }, [I18n.t('notifications.more'), '...'])), h('hr') ); } diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 7a1a75c10d0..528cfea5f3c 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1270,31 +1270,30 @@ en: empty: "No notifications found." more: "view older notifications" total_flagged: "total flagged posts" - mentioned: "

{{username}} {{description}}

" - group_mentioned: "

{{username}} {{description}}

" - quoted: "

{{username}} {{description}}

" - replied: "

{{username}} {{description}}

" - posted: "

{{username}} {{description}}

" - edited: "

{{username}} {{description}}

" - liked: "

{{username}} {{description}}

" - liked_2: "

{{username}}, {{username2}} {{description}}

" + mentioned: "{{username}} {{description}}" + group_mentioned: "{{username}} {{description}}" + quoted: "{{username}} {{description}}" + replied: "{{username}} {{description}}" + posted: "{{username}} {{description}}" + edited: "{{username}} {{description}}" + liked: "{{username}} {{description}}" + liked_2: "{{username}}, {{username2}} {{description}}" liked_many: - one: "

{{username}}, {{username2}} and 1 other {{description}}

" - other: "

{{username}}, {{username2}} and {{count}} others {{description}}

" - private_message: "

{{username}} {{description}}

" - invited_to_private_message: "

{{username}} {{description}}

" - invited_to_topic: "

{{username}} {{description}}

" - invitee_accepted: "

{{username}} accepted your invitation

" - moved_post: "

{{username}} moved {{description}}

" - linked: "

{{username}} {{description}}

" - granted_badge: "

Earned '{{description}}'

" - topic_reminder: "

{{username}} {{description}}

" - - watching_first_post: "

New Topic {{description}}

" + one: "{{username}}, {{username2}} and 1 other {{description}}" + other: "{{username}}, {{username2}} and {{count}} others {{description}}" + private_message: "{{username}} {{description}}" + invited_to_private_message: "

{{username}} {{description}}" + invited_to_topic: "{{username}} {{description}}" + invitee_accepted: "{{username}} accepted your invitation" + moved_post: "{{username}} moved {{description}}" + linked: "{{username}} {{description}}" + granted_badge: "Earned '{{description}}'" + topic_reminder: "{{username}} {{description}}" + watching_first_post: "New Topic {{description}}" group_message_summary: - one: "

{{count}} message in your {{group_name}} inbox

" - other: "

{{count}} messages in your {{group_name}} inbox

" + one: "{{count}} message in your {{group_name}} inbox" + other: "{{count}} messages in your {{group_name}} inbox" alt: mentioned: "Mentioned by"