Skip to content

Commit

Permalink
Refactor email finder and fix keyword parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoerdbeentjes committed Aug 15, 2024
1 parent 2b1dc23 commit f24585e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/api/sync-viewer-layer-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const handler = withServerDefaults(async (event, _) => {
catch (e) {
console.log('The following error occured', e.message)

for (let email of findEmailContactsForLayerId(menuTree, layerId)) {
for (let email of findEmailContactsForId(menuTree, id)) {
console.log('Sending email to', email)

await mailjet.post('send', { version: 'v3.1' }).request({
Expand Down Expand Up @@ -213,7 +213,7 @@ async function syncViewerLayers(menuTree, eventType, viewerLayerId) {

}

function findEmailContactsForLayerId(menuTree, layerId) {
function findEmailContactsForId(menuTree, id) {
const contacts = new Set()

menuTree.forEach((viewer) => {
Expand All @@ -224,7 +224,7 @@ function findEmailContactsForLayerId(menuTree, layerId) {
if (children) {
children.forEach((child) => {

if (child.layer.id === layerId) {
if (child.id === id) {
const { errorNotificationContacts } = viewer

if (errorNotificationContacts.length) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/format-spatial-representation-type.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function formatSpatialRepresentationType(layerInfo) {
const keyword = layerInfo?.KeywordList?.Keyword[0]?._text?.toLowerCase()
const keyword = layerInfo?.KeywordList?.Keyword?.[0]?._text?.toLowerCase()

let representationType

Expand Down

0 comments on commit f24585e

Please sign in to comment.