mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
fixing notifications not being called when same adapter has been used twice
This commit is contained in:
@@ -13,9 +13,12 @@ if (adapter.length === 0) {
|
|||||||
|
|
||||||
exports.send = (serviceName, newListings, notificationConfig, jobKey) => {
|
exports.send = (serviceName, newListings, notificationConfig, jobKey) => {
|
||||||
//this is not being used in tests, therefore adapter are always set
|
//this is not being used in tests, therefore adapter are always set
|
||||||
return adapter
|
return notificationConfig
|
||||||
.filter((notificationAdapter) => {
|
.filter((notificationAdapter) => findAdapter(notificationAdapter) != null)
|
||||||
return notificationConfig.find((config) => config.id === notificationAdapter.config.id);
|
.map((notificationAdapter) => findAdapter(notificationAdapter))
|
||||||
})
|
|
||||||
.map((a) => a.send({ serviceName, newListings, notificationConfig, jobKey }));
|
.map((a) => a.send({ serviceName, newListings, notificationConfig, jobKey }));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const findAdapter = (notificationAdapter) => {
|
||||||
|
return adapter.find((a) => a.config.id === notificationAdapter.id);
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user