mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
zerver/decorator: Set request.client in api_key_only_webhook_view.
Previously, api_key_only_webhook_view passed 3 positional arguments (request, user_profile, and client) into a function. However, most of our other auth decorators only pass 2 positional arguments. For the sake of consistency, we now make api_key_only_webhook_view set request.client and pass only request and user_profile as positional arguments.
This commit is contained in:
@@ -7,7 +7,7 @@ from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_vi
|
||||
from zerver.lib.actions import check_send_message
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.validator import check_dict, check_string, check_bool
|
||||
from zerver.models import UserProfile, Client
|
||||
from zerver.models import UserProfile
|
||||
from typing import Dict
|
||||
|
||||
import ujson
|
||||
@@ -23,7 +23,7 @@ MESSAGE_TEMPLATE = (
|
||||
|
||||
@api_key_only_webhook_view('Travis')
|
||||
@has_request_variables
|
||||
def api_travis_webhook(request, user_profile, client,
|
||||
def api_travis_webhook(request, user_profile,
|
||||
stream=REQ(default='travis'),
|
||||
topic=REQ(default=None),
|
||||
ignore_pull_requests=REQ(validator=check_bool, default=True),
|
||||
@@ -32,7 +32,7 @@ def api_travis_webhook(request, user_profile, client,
|
||||
('status_message', check_string),
|
||||
('compare_url', check_string),
|
||||
]))):
|
||||
# type: (HttpRequest, UserProfile, Client, str, str, str, Dict[str, str]) -> HttpResponse
|
||||
# type: (HttpRequest, UserProfile, str, str, str, Dict[str, str]) -> HttpResponse
|
||||
|
||||
message_status = message['status_message']
|
||||
if ignore_pull_requests and message['type'] == 'pull_request':
|
||||
@@ -53,5 +53,5 @@ def api_travis_webhook(request, user_profile, client,
|
||||
message['build_url']
|
||||
)
|
||||
|
||||
check_send_message(user_profile, client, 'stream', [stream], topic, body)
|
||||
check_send_message(user_profile, request.client, 'stream', [stream], topic, body)
|
||||
return json_success()
|
||||
|
||||
Reference in New Issue
Block a user