From e9063a9d075f299b6dc6dcf747b00e27114c9138 Mon Sep 17 00:00:00 2001 From: Wil T Date: Tue, 30 Jul 2024 19:51:37 -0400 Subject: [PATCH] fix links in formatEvent --- action-network-message-writer.js | 18 +++++++++--------- slack-messages.js | 2 +- text.js | 7 +++++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/action-network-message-writer.js b/action-network-message-writer.js index b36a637..e11bcf5 100644 --- a/action-network-message-writer.js +++ b/action-network-message-writer.js @@ -21,7 +21,7 @@ const draftANMessage = (doc, apiKey) => { return; } - const subject = `🌹 ${emailSubject} for ${Utilities.formatDate(new Date(), "UTC", "yyyy-MM-dd")} 🌹`; + const subject = `🌹 ${emailSubject} for ${Utilities.formatDate(new Date(), "UTC", "yyyy-MM-dd")} 🫎`; const payload = { subject, @@ -34,22 +34,22 @@ const draftANMessage = (doc, apiKey) => { payload.targets = emailTarget ? [ - { - href: `${apiUrlAn}queries/${emailTarget}`, - }, - ] + { + href: `${apiUrlAn}queries/${emailTarget}`, + }, + ] : undefined; payload._links["osdi:wrapper"] = emailWrapper ? { - href: `${apiUrlAn}wrappers/${emailWrapper}`, - } + href: `${apiUrlAn}wrappers/${emailWrapper}`, + } : undefined; payload._links["osdi:creator"] = emailCreator ? { - href: `${apiUrlAn}people/${emailCreator}`, - } + href: `${apiUrlAn}people/${emailCreator}`, + } : undefined; const options = { diff --git a/slack-messages.js b/slack-messages.js index a2e9bf2..4f76004 100644 --- a/slack-messages.js +++ b/slack-messages.js @@ -65,7 +65,7 @@ const sendSlackMessage = (title, message, url, image) => { const options = { method: "POST", contentType: "application/json", - payload: JSON.stringify(slack_webhook_message), + payload: JSON.stringify(slack_webhook_message) }; UrlFetchApp.fetch(scriptProperties.getProperty("SLACK_WEBHOOK_URL"), options); diff --git a/text.js b/text.js index 9730433..19cec49 100644 --- a/text.js +++ b/text.js @@ -31,7 +31,7 @@ const calDescription = (event) => { // This function takes a location object as an argument and generates a string with the venue, address, locality, region, and postal code const formatLocation = (location) => { - const {venue, address_lines, locality, region, postal_code} = location; + const { venue, address_lines, locality, region, postal_code } = location; return `${venue}, ${address_lines.join()}, ${locality}, ${region} ${postal_code}`; }; @@ -60,7 +60,10 @@ const formatEvent = (event) => { : ""; const button_rsvp = ``; - return `
${template_title}${template_time_and_link}${image_url}${button_rsvp}${event.description}
`; + const formatted_body = `
${template_title}${template_time_and_link}${image_url}${button_rsvp}${event.description}
`; + + return formatted_body + .replace(/ {