fix(notification): Properly disable notification providers (#8607)
This commit is contained in:
1 parent
b7bb793f03
commit
bda3f68057
2 files changed
+9
-2
No files matched your search
@@ -104,7 +104,7 @@ async function syncDatabaseProviders({
|
|||||||
providerService.update(
|
providerService.update(
|
||||||
providersToDisable.map((p) => ({
|
providersToDisable.map((p) => ({
|
||||||
id: p.id,
|
id: p.id,
|
||||||
update: { is_enabled: false },
|
is_enabled: false,
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import {
|
|||||||
promiseAll,
|
promiseAll,
|
||||||
} from "@medusajs/utils"
|
} from "@medusajs/utils"
|
||||||
import { Notification } from "@models"
|
import { Notification } from "@models"
|
||||||
import NotificationProviderService from "./notification-provider"
|
|
||||||
import { eventBuilders } from "@utils"
|
import { eventBuilders } from "@utils"
|
||||||
|
import NotificationProviderService from "./notification-provider"
|
||||||
|
|
||||||
type InjectedDependencies = {
|
type InjectedDependencies = {
|
||||||
baseRepository: DAL.RepositoryService
|
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(
|
const res = await this.notificationProviderService_.send(
|
||||||
provider,
|
provider,
|
||||||
entry
|
entry
|
||||||
|
|||||||
Reference in new issue
Block a user