mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +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)
|
||||
return json_success()
|
||||
|
||||
@csrf_exempt
|
||||
def api_pivotal_webhook(request):
|
||||
@api_key_only_webhook_view
|
||||
def api_pivotal_webhook(request, user_profile):
|
||||
try:
|
||||
api_key = request.GET['api_key']
|
||||
stream = request.GET['stream']
|
||||
except (AttributeError, KeyError):
|
||||
return json_error("Missing api_key or 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')
|
||||
return json_error("Missing stream parameter.")
|
||||
|
||||
payload = xml_fromstring(request.body)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user