mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 16:01:58 +00:00
Apply @api_key_only_webhook_view to api_pivotal_webhook.
This makes the code save UserActivity records for this action. (imported from commit d11267ad3913a4dfe90ad7bd8b30704c7ddb7cb3)
This commit is contained in:
@@ -287,21 +287,12 @@ def api_jira_webhook(request, user_profile):
|
|||||||
check_send_message(user_profile, get_client("API"), "stream", [stream], subject, content)
|
check_send_message(user_profile, get_client("API"), "stream", [stream], subject, content)
|
||||||
return json_success()
|
return json_success()
|
||||||
|
|
||||||
@csrf_exempt
|
@api_key_only_webhook_view
|
||||||
def api_pivotal_webhook(request):
|
def api_pivotal_webhook(request, user_profile):
|
||||||
try:
|
try:
|
||||||
api_key = request.GET['api_key']
|
|
||||||
stream = request.GET['stream']
|
stream = request.GET['stream']
|
||||||
except (AttributeError, KeyError):
|
except (AttributeError, KeyError):
|
||||||
return json_error("Missing api_key or stream parameter.")
|
return json_error("Missing stream parameter.")
|
||||||
|
|
||||||
try:
|
|
||||||
user_profile = UserProfile.objects.get(api_key=api_key)
|
|
||||||
request.user = user_profile
|
|
||||||
except UserProfile.DoesNotExist:
|
|
||||||
return json_error("Failed to find user with API key: %s" % (api_key,))
|
|
||||||
|
|
||||||
rate_limit_user(request, user_profile, domain='all')
|
|
||||||
|
|
||||||
payload = xml_fromstring(request.body)
|
payload = xml_fromstring(request.body)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user