Skip to content

Commit 98aa233

Browse files
committed
Exclude facilitator sync from merchant research notifications
Facilitator-discovered origins are automated, not real signups — they shouldn't trigger merchant research follow-up. Added merchantResearch option to notifyNewServer (defaults true), sync job passes false.
1 parent d862c8b commit 98aa233

2 files changed

Lines changed: 20 additions & 12 deletions

File tree

apps/scan/src/app/api/resources/sync/route.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,15 @@ export const GET = async (request: NextRequest) => {
178178
const upsertedOrigin = await upsertOrigin(originData);
179179

180180
if (!preexistingOrigins.has(origin) && upsertedOrigin) {
181-
notifyNewServer({
182-
originId: upsertedOrigin.id,
183-
origin,
184-
title: originData.title ?? null,
185-
description: originData.description ?? null,
186-
});
181+
notifyNewServer(
182+
{
183+
originId: upsertedOrigin.id,
184+
origin,
185+
title: originData.title ?? null,
186+
description: originData.description ?? null,
187+
},
188+
{ merchantResearch: false }
189+
);
187190
}
188191

189192
return { origin, success: true };

apps/scan/src/lib/discord-notifications.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,23 @@ interface DiscordConfig {
1818
appUrl: string;
1919
}
2020

21-
export function notifyNewServer(notification: NewServerNotification) {
21+
export function notifyNewServer(
22+
notification: NewServerNotification,
23+
options?: { merchantResearch?: boolean }
24+
) {
2225
scheduleDiscordNotification({
2326
webhookUrl: env.DISCORD_NOTIFICATIONS_WEBHOOK_URL,
2427
username: NEW_SERVER_USERNAME,
2528
embed: config => buildNewServerEmbed(notification, config),
2629
});
2730

28-
scheduleDiscordNotification({
29-
webhookUrl: env.DISCORD_MERCHANT_RESEARCH_WEBHOOK_URL,
30-
username: NEW_SERVER_USERNAME,
31-
embed: config => buildMerchantResearchEmbed(notification, config),
32-
});
31+
if (options?.merchantResearch ?? true) {
32+
scheduleDiscordNotification({
33+
webhookUrl: env.DISCORD_MERCHANT_RESEARCH_WEBHOOK_URL,
34+
username: NEW_SERVER_USERNAME,
35+
embed: config => buildMerchantResearchEmbed(notification, config),
36+
});
37+
}
3338
}
3439

3540
function scheduleDiscordNotification(options: {

0 commit comments

Comments
 (0)