Skip to content

Commit

Permalink
Merge pull request #918 from alromh87/bug903
Browse files Browse the repository at this point in the history
Bug903
  • Loading branch information
BenGamma authored Mar 25, 2020
2 parents 643727c + f1461bb commit 80f1109
Showing 1 changed file with 3 additions and 1 deletion.
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 80f1109

Please sign in to comment.