Skip to content

Commit

Permalink
fix(notification): Properly disable notification providers (#8607)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivermrbl authored Aug 15, 2024
1 parent b7bb793 commit bda3f68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/modules/notification/src/loaders/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async function syncDatabaseProviders({
providerService.update(
providersToDisable.map((p) => ({
id: p.id,
update: { is_enabled: false },
is_enabled: false,
}))
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bda3f68

Please sign in to comment.