🐛(webhooks) fix special case for tchap integration
we want to use Tchap integration server for our own preprod but it doesn't follow the same url naming convention as the other Tchap instances, so it requires a special treatment. This quick fix should do it.
This commit is contained in:
committed by
Marie
parent
fdec3b4196
commit
0f4ec63a9f
@@ -230,6 +230,9 @@ def test_matrix_webhook__override_secret_for_tchap():
|
||||
headers = responses.calls[0].request.headers
|
||||
assert "TCHAP_TOKEN" in headers["Authorization"]
|
||||
|
||||
# Check correctly inferred base url from room_id
|
||||
assert "matrix.home_server" in responses.calls[0].request.url
|
||||
|
||||
|
||||
## KICK
|
||||
@responses.activate
|
||||
|
||||
@@ -45,7 +45,7 @@ class MatrixAPIClient:
|
||||
"""Returns room id from webhook url."""
|
||||
room_id = webhook_url.split("/room/")[1]
|
||||
base_url = room_id.split(":")[1]
|
||||
if "tchap.gouv.fr" in webhook_url:
|
||||
if "tchap.gouv.fr" in webhook_url and "i.tchap.gouv.fr" not in webhook_url:
|
||||
base_url = f"matrix.{base_url}"
|
||||
return f"https://{base_url}/_matrix/client/v3/rooms/{room_id}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user