diff options
author | Yamagishi Kazutoshi <ykzts@desire.sh> | 2017-05-11 20:34:05 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-11 13:34:05 +0200 |
commit | 88fd5cb68829f87ca3ec74d590299de508fac274 (patch) | |
tree | 0bfda1e37c3d6b28918e19291a8b8c7bd6dc79a3 /app/javascript | |
parent | c78e8c01a37c342977b35396007dce7f58052b20 (diff) |
Focus tab of Mastodon when clicking notification (#2989)
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/actions/notifications.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/mastodon/actions/notifications.js index 1be4ae3a1..bb494924d 100644 --- a/app/javascript/mastodon/actions/notifications.js +++ b/app/javascript/mastodon/actions/notifications.js @@ -50,7 +50,11 @@ export function updateNotifications(notification, intlMessages, intlLocale) { const title = new IntlMessageFormat(intlMessages[`notification.${notification.type}`], intlLocale).format({ name: notification.account.display_name.length > 0 ? notification.account.display_name : notification.account.username }); const body = (notification.status && notification.status.spoiler_text.length > 0) ? unescapeHTML(notification.status.spoiler_text) : unescapeHTML(notification.status ? notification.status.content : ''); - new Notification(title, { body, icon: notification.account.avatar, tag: notification.id }); + const notify = new Notification(title, { body, icon: notification.account.avatar, tag: notification.id }); + notify.addEventListener('click', () => { + window.focus(); + notify.close(); + }); } }; }; |