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