mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: prevent desktop notification callbacks on mobile (#28527)
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
|||||||
alertChannel,
|
alertChannel,
|
||||||
disable as disableDesktopNotifications,
|
disable as disableDesktopNotifications,
|
||||||
init as initDesktopNotifications,
|
init as initDesktopNotifications,
|
||||||
onNotification,
|
onNotification as onDesktopNotification,
|
||||||
} from "discourse/lib/desktop-notifications";
|
} from "discourse/lib/desktop-notifications";
|
||||||
import {
|
import {
|
||||||
isPushNotificationsEnabled,
|
isPushNotificationsEnabled,
|
||||||
@@ -260,11 +260,13 @@ export default {
|
|||||||
|
|
||||||
@bind
|
@bind
|
||||||
onAlert(data) {
|
onAlert(data) {
|
||||||
return onNotification(
|
if (this.site.desktopView) {
|
||||||
data,
|
return onDesktopNotification(
|
||||||
this.siteSettings,
|
data,
|
||||||
this.currentUser,
|
this.siteSettings,
|
||||||
this.appEvents
|
this.currentUser,
|
||||||
);
|
this.appEvents
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Service, { service } from "@ember/service";
|
import Service, { service } from "@ember/service";
|
||||||
import {
|
import {
|
||||||
alertChannel,
|
alertChannel,
|
||||||
onNotification,
|
onNotification as onDesktopNotification,
|
||||||
} from "discourse/lib/desktop-notifications";
|
} from "discourse/lib/desktop-notifications";
|
||||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||||
import { isTesting } from "discourse-common/config/environment";
|
import { isTesting } from "discourse-common/config/environment";
|
||||||
@@ -13,6 +13,7 @@ export default class ChatNotificationManager extends Service {
|
|||||||
@service chatStateManager;
|
@service chatStateManager;
|
||||||
@service currentUser;
|
@service currentUser;
|
||||||
@service appEvents;
|
@service appEvents;
|
||||||
|
@service site;
|
||||||
|
|
||||||
_subscribedToCore = true;
|
_subscribedToCore = true;
|
||||||
_subscribedToChat = false;
|
_subscribedToChat = false;
|
||||||
@@ -149,12 +150,14 @@ export default class ChatNotificationManager extends Service {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return onNotification(
|
if (this.site.desktopView) {
|
||||||
data,
|
return onDesktopNotification(
|
||||||
this.siteSettings,
|
data,
|
||||||
this.currentUser,
|
this.siteSettings,
|
||||||
this.appEvents
|
this.currentUser,
|
||||||
);
|
this.appEvents
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_shouldRun() {
|
_shouldRun() {
|
||||||
|
|||||||
Reference in New Issue
Block a user