fix(notification): Properly disable notification providers (#8607)

This commit is contained in:
Oli Juhl
2024-08-15 14:59:14 +02:00
committed by GitHub
parent b7bb793f03
commit bda3f68057
2 changed files with 9 additions and 2 deletions

View File

@@ -104,7 +104,7 @@ async function syncDatabaseProviders({
providerService.update(
providersToDisable.map((p) => ({
id: p.id,
update: { is_enabled: false },
is_enabled: false,
}))
)
)

View File

@@ -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