Skip to content

Commit

Permalink
Only send success emails if areas have status "saved"
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrique Pacheco committed Aug 11, 2020
1 parent 89a12fc commit 8a914ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/src/routes/api/v2/area.router.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,8 @@ class AreaRouterV2 {
const areas = await AreaModel.find({ geostore: { $in: geostores } });
ctx.body = AreaSerializerV2.serialize(areas);

await Promise.all(areas.map((area) => {
const areasToNotify = areas.filter((a) => a.status === 'saved');
await Promise.all(areasToNotify.map((area) => {
const { email, application } = area;
const lang = area.language || 'en';
if (!email) {
Expand Down

0 comments on commit 8a914ad

Please sign in to comment.