Skip to content

A platform for community discussion. Free, open, simple.

FIX: add title attribute for notifications

Maja Komelc9a34aa10c23
diff --git a/app/assets/javascripts/discourse/widgets/notification-item.js.es6 b/app/assets/javascripts/discourse/widgets/notification-item.js.es6
index a298e1ab938..a0d01f3f05c 100644
--- a/app/assets/javascripts/discourse/widgets/notification-item.js.es6
+++ b/app/assets/javascripts/discourse/widgets/notification-item.js.es6
@@ -147,13 +147,22 @@ createWidget("notification-item", {
html(attrs) {
const notificationType = attrs.notification_type;
const lookup = this.site.get("notificationLookup");
- const notName = lookup[notificationType];
+ const notificationName = lookup[notificationType];
let { data } = attrs;
- let infoKey = notName === "custom" ? data.message : notName;
- let text = emojiUnescape(this.text(notificationType, notName));
+ let infoKey =
+ notificationName === "custom" ? data.message : notificationName;
+ let text = emojiUnescape(this.text(notificationType, notificationName));
let icon = iconNode(`notification.${infoKey}`);
+ let title;
+
+ if (notificationName) {
+ title = I18n.t(`notification.titles.${notificationName}`);
+ } else {
+ title = "";
+ }
+
// We can use a `<p>` tag here once other languages have fixed their HTML
// translations.
let html = new RawHtml({ html: `<div>${text}</div>` });
@@ -162,7 +171,11 @@ createWidget("notification-item", {
const href = this.url();
return href
- ? h("a", { attributes: { href, "data-auto-route": true } }, contents)
+ ? h(
+ "a",
+ { attributes: { href, title, "data-auto-route": true } },
+ contents
+ )
: contents;
},
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 1fef32c25db..030d754a826 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -1712,6 +1712,27 @@ en:
confirm_body: "Success! Notifications have been enabled."
custom: "Notification from {{username}} on %{site_title}"
+ titles:
+ mentioned: "mentioned"
+ replied: "new reply"
+ quoted: "quoted"
+ edited: "edited"
+ liked: "new like"
+ private_message: "new private message"
+ invited_to_private_message: "invited to private message"
+ invitee_accepted: "invite accepted"
+ posted: "new post"
+ moved_post: "post moved"
+ linked: "linked"
+ granted_badge: "badge granted"
+ invited_to_topic: "invited to topic"
+ group_mentioned: "group mentioned"
+ group_message_summary: "new group messages"
+ watching_first_post: "new topic"
+ topic_reminder: "topic reminder"
+ liked_consolidated: "new likes"
+ post_approved: "post approved"
+
upload_selector:
title: "Add an image"
title_with_attachments: "Add an image or a file"