Ensure notifications are enabled
This commit is contained in:
parent
fedb17ba24
commit
4a345d7127
1 changed files with 4 additions and 1 deletions
|
@ -107,7 +107,10 @@ const updateNotificationsQueue = (notification: APIEntity, intlMessages: Record<
|
||||||
|
|
||||||
// Desktop notifications
|
// Desktop notifications
|
||||||
try {
|
try {
|
||||||
if (showAlert && !filtered) {
|
// eslint-disable-next-line compat/compat
|
||||||
|
const isNotificationsEnabled = typeof window.Notification !== 'undefined' && Notification.permission === 'granted';
|
||||||
|
|
||||||
|
if (showAlert && !filtered && isNotificationsEnabled) {
|
||||||
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 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 body = (notification.status && notification.status.spoiler_text.length > 0) ? notification.status.spoiler_text : unescapeHTML(notification.status ? notification.status.content : '');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue