Skip to content

Commit

Permalink
Merge f1461bb into 6551911
Browse files Browse the repository at this point in the history
  • Loading branch information
alromh87 authored Mar 24, 2020
2 parents 6551911 + f1461bb commit e1e3bef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions functions/src/Integrations/firebase-discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const notifyPinAccepted = functions.firestore
const { _id, type } = info
await axios
.post(DISCORD_WEBHOOK_URL, {
content: `📍 *New ${type}* pin from ${_id}. \n Location here ${SITE_URL}/map/#${_id}`,
content: `📍 *New ${type}* pin from ${_id}. \n Location here <${SITE_URL}/map/#${_id}>`,
})
.then(handleResponse, handleErr)
.catch(handleErr)
Expand All @@ -34,7 +34,7 @@ export const notifyHowToAccepted = functions.firestore
await axios
.post(DISCORD_WEBHOOK_URL, {
content: `📓 Yeah! New How To **${title}** by *${_createdBy}*
check it out: ${SITE_URL}/how-to/${slug}`,
check it out: <${SITE_URL}/how-to/${slug}>`,
})
.then(handleResponse, handleErr)
.catch(handleErr)
Expand All @@ -53,7 +53,7 @@ export const notifyEventAccepted = functions.firestore
await axios
.post(DISCORD_WEBHOOK_URL, {
content: `📅 Jeej new event in **${location}** by *${user}* posted here:
${url}`,
<${url}>`,
})
.then(handleResponse, handleErr)
.catch(handleErr)
Expand Down
4 changes: 3 additions & 1 deletion functions/src/Integrations/firebase-slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export const notifyNewPin = functions.firestore
.document('v3_mappins/{pinId}')
.onWrite((change, context) => {
const info = change.after.exists ? change.after.data() : null
if (info === null || info.moderation !== 'awaiting-moderation') {
const prevInfo = change.before.exists ? change.before.data() : null
const prevModeration = (prevInfo !== null) ? prevInfo.moderation : null;
if (info === null || info.moderation !== 'awaiting-moderation' || prevModeration === 'awaiting-moderation') {
return
}

Expand Down

0 comments on commit e1e3bef

Please sign in to comment.