[meta] Add a special case for comments in the notifier workaround (#1229)

Discord still hasn't fixed the issue on their end, and having a top
level link whenever a new comment is added is getting cumbersome, so add
a handler for the common comments case too.

Tested and deployed.
This commit is contained in:
Manav Rathi 2024-03-28 10:12:22 +05:30 committed by GitHub
commit 33314bc2da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -65,7 +65,10 @@ const handleRequest = async (request: Request, discordWebhookURL: string) => {
// arrangement (we shouldn't be getting 429s forever), so just try to
// see if we can extract a URL from something we recognize.
let activityURL: string | undefined;
if (requestJSON["issue"]) {
if (requestJSON["comment"]) {
activityURL = requestJSON["comment"]["html_url"];
}
if (!activityURL && requestJSON["issue"]) {
activityURL = requestJSON["issue"]["html_url"];
}
if (!activityURL && requestJSON["discussion"]) {