FIX: add title attribute for notifications
This commit is contained in:
parent
6afd7f0eae
commit
c9a34aa10c
|
@ -147,13 +147,22 @@ createWidget("notification-item", {
|
||||||
html(attrs) {
|
html(attrs) {
|
||||||
const notificationType = attrs.notification_type;
|
const notificationType = attrs.notification_type;
|
||||||
const lookup = this.site.get("notificationLookup");
|
const lookup = this.site.get("notificationLookup");
|
||||||
const notName = lookup[notificationType];
|
const notificationName = lookup[notificationType];
|
||||||
|
|
||||||
let { data } = attrs;
|
let { data } = attrs;
|
||||||
let infoKey = notName === "custom" ? data.message : notName;
|
let infoKey =
|
||||||
let text = emojiUnescape(this.text(notificationType, notName));
|
notificationName === "custom" ? data.message : notificationName;
|
||||||
|
let text = emojiUnescape(this.text(notificationType, notificationName));
|
||||||
let icon = iconNode(`notification.${infoKey}`);
|
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
|
// We can use a `<p>` tag here once other languages have fixed their HTML
|
||||||
// translations.
|
// translations.
|
||||||
let html = new RawHtml({ html: `<div>${text}</div>` });
|
let html = new RawHtml({ html: `<div>${text}</div>` });
|
||||||
|
@ -162,7 +171,11 @@ createWidget("notification-item", {
|
||||||
|
|
||||||
const href = this.url();
|
const href = this.url();
|
||||||
return href
|
return href
|
||||||
? h("a", { attributes: { href, "data-auto-route": true } }, contents)
|
? h(
|
||||||
|
"a",
|
||||||
|
{ attributes: { href, title, "data-auto-route": true } },
|
||||||
|
contents
|
||||||
|
)
|
||||||
: contents;
|
: contents;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1712,6 +1712,27 @@ en:
|
||||||
confirm_body: "Success! Notifications have been enabled."
|
confirm_body: "Success! Notifications have been enabled."
|
||||||
custom: "Notification from {{username}} on %{site_title}"
|
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:
|
upload_selector:
|
||||||
title: "Add an image"
|
title: "Add an image"
|
||||||
title_with_attachments: "Add an image or a file"
|
title_with_attachments: "Add an image or a file"
|
||||||
|
|
Loading…
Reference in New Issue