mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
Use POST, not PATCH, for patching bots.
This is a temporary expedient measure to work around our PATCH not supporting file uploads in our current Django setup. (imported from commit c3146b23d5d7d134c2b80507eb87033ca375a4db)
This commit is contained in:
@@ -173,7 +173,7 @@ v1_api_and_json_patterns = patterns('zephyr.views',
|
||||
url(r'^bots/(?P<email>.*)/api_key/regenerate$', 'rest_dispatch',
|
||||
{'POST': 'regenerate_bot_api_key'}),
|
||||
url(r'^bots/(?P<email>.*)$', 'rest_dispatch',
|
||||
{'PATCH': 'patch_bot_backend'}),
|
||||
{'POST': 'update_bot_backend'}),
|
||||
url(r'^register$', 'rest_dispatch',
|
||||
{'POST': 'api_events_register'}),
|
||||
url(r'^messages/latest$', 'rest_dispatch',
|
||||
|
||||
@@ -172,7 +172,7 @@ $(function () {
|
||||
edit_button.hide();
|
||||
$.ajax({
|
||||
url: '/json/bots/' + encodeURIComponent(email),
|
||||
type: 'PATCH',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
cache: false,
|
||||
processData: false,
|
||||
|
||||
@@ -590,7 +590,7 @@ class BotTest(AuthedTestCase):
|
||||
bot_info = {
|
||||
'full_name': 'Fred',
|
||||
}
|
||||
result = self.client_patch("/json/bots/hambot-bot@zulip.com", bot_info)
|
||||
result = self.client.post("/json/bots/hambot-bot@zulip.com", bot_info)
|
||||
self.assert_json_error(result, 'Insufficient permission')
|
||||
|
||||
def get_bot(self):
|
||||
@@ -621,7 +621,7 @@ class BotTest(AuthedTestCase):
|
||||
bot_info = {
|
||||
'full_name': 'Fred',
|
||||
}
|
||||
result = self.client_patch("/json/bots/hambot-bot@zulip.com", bot_info)
|
||||
result = self.client.post("/json/bots/hambot-bot@zulip.com", bot_info)
|
||||
self.assert_json_success(result)
|
||||
|
||||
full_name = ujson.loads(result.content)['full_name']
|
||||
@@ -637,7 +637,7 @@ class BotTest(AuthedTestCase):
|
||||
bot_info = {
|
||||
'full_name': 'Fred',
|
||||
}
|
||||
result = self.client_patch("/json/bots/nonexistent-bot@zulip.com", bot_info)
|
||||
result = self.client.post("/json/bots/nonexistent-bot@zulip.com", bot_info)
|
||||
self.assert_json_error(result, 'No such user')
|
||||
self.assert_num_bots_equal(1)
|
||||
|
||||
|
||||
@@ -2027,7 +2027,7 @@ def deactivate_user_backend(request, user_profile, email):
|
||||
return json_success({})
|
||||
|
||||
@has_request_variables
|
||||
def patch_bot_backend(request, user_profile, email, full_name=REQ):
|
||||
def update_bot_backend(request, user_profile, email, full_name=REQ):
|
||||
# TODO:
|
||||
# 1) Validate data
|
||||
# 2) Support avatar changes
|
||||
|
||||
Reference in New Issue
Block a user