diff --git a/plugins/slack/server/processors/SlackProcessor.ts b/plugins/slack/server/processors/SlackProcessor.ts index b33ebe0ad..5cbb7d3f3 100644 --- a/plugins/slack/server/processors/SlackProcessor.ts +++ b/plugins/slack/server/processors/SlackProcessor.ts @@ -1,6 +1,8 @@ +import { differenceInMilliseconds } from "date-fns"; import fetch from "fetch-with-proxy"; import { Op } from "sequelize"; import { IntegrationService, IntegrationType } from "@shared/types"; +import { Minute } from "@shared/utils/time"; import env from "@server/env"; import { Document, Integration, Collection, Team } from "@server/models"; import BaseProcessor from "@server/queues/processors/BaseProcessor"; @@ -94,9 +96,12 @@ export default class SlackProcessor extends BaseProcessor { return; } + // if the document was published less than a minute ago, don't send a + // separate notification. if ( event.name === "revisions.create" && - document.updatedAt === document.publishedAt + differenceInMilliseconds(document.updatedAt, document.publishedAt) < + Minute ) { return; }