From 74f8d19e235784d53e015a5226bd5dd3a252d969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Melaine=20G=C3=A9rard?= Date: Sun, 1 Dec 2024 20:53:50 +0100 Subject: [PATCH] :sparkles: Allow to use custom query parameters --- .../provider/discord/discord_provider.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/discourse_chat_integration/provider/discord/discord_provider.rb b/lib/discourse_chat_integration/provider/discord/discord_provider.rb index bdfab282..ebf65a2b 100644 --- a/lib/discourse_chat_integration/provider/discord/discord_provider.rb +++ b/lib/discourse_chat_integration/provider/discord/discord_provider.rb @@ -79,8 +79,12 @@ def self.generate_discord_message(post) end def self.trigger_notification(post, channel, rule) + # Splitting the URL in order to support custom query parameters (e.g. thread_id=1234) + splitted_url = channel.data["webhook_url"].split("?") + webhook_url = "#{splitted_url[0]}?wait=true" # Adding ?wait=true means that we actually get a success/failure response, rather than returning asynchronously - webhook_url = "#{channel.data["webhook_url"]}?wait=true" + + webhook_url += "&" + splitted_url[1] if splitted_url.length > 1 message = generate_discord_message(post) response = send_message(webhook_url, message)