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:
Steve Howell
2013-10-03 13:06:14 -04:00
parent 1c46eca0ef
commit c990d942ac

View File

@@ -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)