Merge branch 'streaming-fix' into 'develop'
Fix streaming notifictaions Closes #653 See merge request soapbox-pub/soapbox-fe!537
This commit is contained in:
commit
4b790caa72
1 changed files with 12 additions and 8 deletions
|
@ -92,16 +92,20 @@ export function updateNotificationsQueue(notification, intlMessages, intlLocale,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Desktop notifications
|
// Desktop notifications
|
||||||
if (typeof window.Notification !== 'undefined' && showAlert && !filtered) {
|
try {
|
||||||
const title = new IntlMessageFormat(intlMessages[`notification.${notification.type}`], intlLocale).format({ name: notification.account.display_name.length > 0 ? notification.account.display_name : notification.account.username });
|
if (typeof window.Notification !== 'undefined' && showAlert && !filtered) {
|
||||||
const body = (notification.status && notification.status.spoiler_text.length > 0) ? notification.status.spoiler_text : unescapeHTML(notification.status ? notification.status.content : '');
|
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) ? notification.status.spoiler_text : unescapeHTML(notification.status ? notification.status.content : '');
|
||||||
|
|
||||||
const notify = 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', () => {
|
notify.addEventListener('click', () => {
|
||||||
window.focus();
|
window.focus();
|
||||||
notify.close();
|
notify.close();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
console.warn(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playSound && !filtered) {
|
if (playSound && !filtered) {
|
||||||
|
|
Loading…
Reference in a new issue