fix(notification): Properly disable notification providers (#8607)
This commit is contained in:
@@ -104,7 +104,7 @@ async function syncDatabaseProviders({
|
||||
providerService.update(
|
||||
providersToDisable.map((p) => ({
|
||||
id: p.id,
|
||||
update: { is_enabled: false },
|
||||
is_enabled: false,
|
||||
}))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -17,8 +17,8 @@ import {
|
||||
promiseAll,
|
||||
} from "@medusajs/utils"
|
||||
import { Notification } from "@models"
|
||||
import NotificationProviderService from "./notification-provider"
|
||||
import { eventBuilders } from "@utils"
|
||||
import NotificationProviderService from "./notification-provider"
|
||||
|
||||
type InjectedDependencies = {
|
||||
baseRepository: DAL.RepositoryService
|
||||
@@ -138,6 +138,13 @@ export default class NotificationModuleService
|
||||
)
|
||||
}
|
||||
|
||||
if (!provider.is_enabled) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.NOT_FOUND,
|
||||
`Notification provider ${provider.id} is not enabled. To enable it, configure it as a provider in the notification module options.`
|
||||
)
|
||||
}
|
||||
|
||||
const res = await this.notificationProviderService_.send(
|
||||
provider,
|
||||
entry
|
||||
|
||||
Reference in New Issue
Block a user