diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-01-17 20:09:03 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-01-17 20:09:03 +0100 |
commit | fcb5a85cdd21b8a48c16cd02885933bcbdb07ec2 (patch) | |
tree | 25bb41359a72f821730045f9e55cb60b096e4257 /app/assets/javascripts/components/actions | |
parent | d7a7baa9a7f6b44a3c0b7232e909e456c9231543 (diff) |
Add sounds for notifications. Boop by @jk@mastodon.social
Diffstat (limited to 'app/assets/javascripts/components/actions')
-rw-r--r-- | app/assets/javascripts/components/actions/notifications.jsx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/assets/javascripts/components/actions/notifications.jsx b/app/assets/javascripts/components/actions/notifications.jsx index 1e5b2c382..8688267f4 100644 --- a/app/assets/javascripts/components/actions/notifications.jsx +++ b/app/assets/javascripts/components/actions/notifications.jsx @@ -24,17 +24,21 @@ const fetchRelatedRelationships = (dispatch, notifications) => { export function updateNotifications(notification, intlMessages, intlLocale) { return (dispatch, getState) => { + const showAlert = getState().getIn(['notifications', 'settings', 'alerts', notification.type], false); + const playSound = getState().getIn(['notifications', 'settings', 'sounds', notification.type], false); + dispatch({ type: NOTIFICATIONS_UPDATE, notification, account: notification.account, - status: notification.status + status: notification.status, + meta: playSound ? { sound: 'boop' } : null }); fetchRelatedRelationships(dispatch, [notification]); // Desktop notifications - if (typeof window.Notification !== 'undefined' && getState().getIn(['notifications', 'settings', 'alerts', notification.type], false)) { + if (typeof window.Notification !== 'undefined' && showAlert) { 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 = $('<p>').html(notification.status ? notification.status.content : '').text(); |