Skip to content

Commit

Permalink
Ignore Discourse callbacks about non-regular new topics
Browse files Browse the repository at this point in the history
  • Loading branch information
zoul committed Jul 17, 2024
1 parent 5e9209b commit 775656d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/api/discourse-new-topic/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ export async function POST(request: NextRequest): Promise<Response> {
});
}

if (newTopicInfo.topic.archetype !== "regular") {
return new Response(
"We only care about regular topics, but thanks, try next time.",
{ status: 200 },
);
}

console.log(
`New topic was created, #${newTopicInfo.topic.id}, will fetch it after a brief pause.`,
);
Expand Down
1 change: 1 addition & 0 deletions src/discourse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const decodeNewTopicCallback = record({
tags: array(string),
title: string,
created_by: decodeUser,
archetype: string,
}),
});

Expand Down

0 comments on commit 775656d

Please sign in to comment.