mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
Use PATCH again for patching bots.
This reverts a prior commit, but the earlier commit is fine functionally; the earlier commit was a temporary measure. Revert "Use POST, not PATCH, for patching bots." This reverts commit c3146b23d5d7d134c2b80507eb87033ca375a4db. (imported from commit ebfcb2bae72c11767f9750412440d40b7a2a4995)
This commit is contained in:
@@ -175,7 +175,7 @@ v1_api_and_json_patterns = patterns('zephyr.views',
|
|||||||
url(r'^bots/(?P<email>.*)/api_key/regenerate$', 'rest_dispatch',
|
url(r'^bots/(?P<email>.*)/api_key/regenerate$', 'rest_dispatch',
|
||||||
{'POST': 'regenerate_bot_api_key'}),
|
{'POST': 'regenerate_bot_api_key'}),
|
||||||
url(r'^bots/(?P<email>.*)$', 'rest_dispatch',
|
url(r'^bots/(?P<email>.*)$', 'rest_dispatch',
|
||||||
{'POST': 'update_bot_backend'}),
|
{'PATCH': 'patch_bot_backend'}),
|
||||||
url(r'^register$', 'rest_dispatch',
|
url(r'^register$', 'rest_dispatch',
|
||||||
{'POST': 'api_events_register'}),
|
{'POST': 'api_events_register'}),
|
||||||
url(r'^messages/latest$', 'rest_dispatch',
|
url(r'^messages/latest$', 'rest_dispatch',
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ $(function () {
|
|||||||
edit_button.hide();
|
edit_button.hide();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/json/bots/' + encodeURIComponent(email),
|
url: '/json/bots/' + encodeURIComponent(email),
|
||||||
type: 'POST',
|
type: 'PATCH',
|
||||||
data: formData,
|
data: formData,
|
||||||
cache: false,
|
cache: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
|
|||||||
@@ -590,7 +590,7 @@ class BotTest(AuthedTestCase):
|
|||||||
bot_info = {
|
bot_info = {
|
||||||
'full_name': 'Fred',
|
'full_name': 'Fred',
|
||||||
}
|
}
|
||||||
result = self.client.post("/json/bots/hambot-bot@zulip.com", bot_info)
|
result = self.client_patch("/json/bots/hambot-bot@zulip.com", bot_info)
|
||||||
self.assert_json_error(result, 'Insufficient permission')
|
self.assert_json_error(result, 'Insufficient permission')
|
||||||
|
|
||||||
def get_bot(self):
|
def get_bot(self):
|
||||||
@@ -621,7 +621,7 @@ class BotTest(AuthedTestCase):
|
|||||||
bot_info = {
|
bot_info = {
|
||||||
'full_name': 'Fred',
|
'full_name': 'Fred',
|
||||||
}
|
}
|
||||||
result = self.client.post("/json/bots/hambot-bot@zulip.com", bot_info)
|
result = self.client_patch("/json/bots/hambot-bot@zulip.com", bot_info)
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
|
||||||
full_name = ujson.loads(result.content)['full_name']
|
full_name = ujson.loads(result.content)['full_name']
|
||||||
@@ -637,7 +637,7 @@ class BotTest(AuthedTestCase):
|
|||||||
bot_info = {
|
bot_info = {
|
||||||
'full_name': 'Fred',
|
'full_name': 'Fred',
|
||||||
}
|
}
|
||||||
result = self.client.post("/json/bots/nonexistent-bot@zulip.com", bot_info)
|
result = self.client_patch("/json/bots/nonexistent-bot@zulip.com", bot_info)
|
||||||
self.assert_json_error(result, 'No such user')
|
self.assert_json_error(result, 'No such user')
|
||||||
self.assert_num_bots_equal(1)
|
self.assert_num_bots_equal(1)
|
||||||
|
|
||||||
|
|||||||
@@ -2033,7 +2033,7 @@ def deactivate_user_backend(request, user_profile, email):
|
|||||||
return json_success({})
|
return json_success({})
|
||||||
|
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def update_bot_backend(request, user_profile, email, full_name=REQ):
|
def patch_bot_backend(request, user_profile, email, full_name=REQ):
|
||||||
# TODO:
|
# TODO:
|
||||||
# 1) Validate data
|
# 1) Validate data
|
||||||
# 2) Support avatar changes
|
# 2) Support avatar changes
|
||||||
|
|||||||
Reference in New Issue
Block a user