mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 01:16:19 +00:00
outgoing_webhook: Join build_bot_request and send_data_to_server.
The existing organization, of returning an opaque blob from `build_bot_request`, which was later consumed by `send_data_to_server`, is not particularly sensible; the steps become oddly split between the OutgoingWebhookWorker, `do_rest_call`, and the `OutgoingWebhookServiceInterface`. Make the `OutgoingWebhookServiceInterface` in charge of building, making, and returning the request in one method; another method handles extracting content from a successful response. `do_rest_call` is responsible for calling both halves of this, and doing common error handling.
This commit is contained in:
committed by
Tim Abbott
parent
be706ea7a1
commit
a280905a89
@@ -742,9 +742,7 @@ class OutgoingWebhookWorker(QueueProcessingWorker):
|
||||
for service in services:
|
||||
event["service_name"] = str(service.name)
|
||||
service_handler = get_outgoing_webhook_service_handler(service)
|
||||
request_data = service_handler.build_bot_request(event)
|
||||
if request_data:
|
||||
do_rest_call(service.base_url, request_data, event, service_handler)
|
||||
do_rest_call(service.base_url, event, service_handler)
|
||||
|
||||
|
||||
@assign_queue("embedded_bots")
|
||||
|
||||
Reference in New Issue
Block a user