mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
urls: Use POST for zerver.views.user_settings.set_avatar_backend.
The set_avatar_backend is changed from PUT to POST becuase this is not idempotent.
This commit is contained in:
@@ -209,7 +209,7 @@ exports.set_up = function () {
|
||||
var spinner = $("#upload_avatar_spinner").expectOne();
|
||||
loading.make_indicator(spinner, {text: 'Uploading avatar.'});
|
||||
|
||||
channel.put({
|
||||
channel.post({
|
||||
url: '/json/users/me/avatar',
|
||||
data: form_data,
|
||||
cache: false,
|
||||
|
||||
@@ -614,7 +614,7 @@ class AvatarTest(UploadSerializeMixin, ZulipTestCase):
|
||||
self.login(self.example_email("hamlet"))
|
||||
with get_test_image_file('img.png') as fp1, \
|
||||
get_test_image_file('img.png') as fp2:
|
||||
result = self.client_put_multipart("/json/users/me/avatar", {'f1': fp1, 'f2': fp2})
|
||||
result = self.client_post("/json/users/me/avatar", {'f1': fp1, 'f2': fp2})
|
||||
self.assert_json_error(result, "You must upload exactly one avatar.")
|
||||
|
||||
def test_no_file_upload_failure(self):
|
||||
@@ -624,7 +624,7 @@ class AvatarTest(UploadSerializeMixin, ZulipTestCase):
|
||||
"""
|
||||
self.login(self.example_email("hamlet"))
|
||||
|
||||
result = self.client_put_multipart("/json/users/me/avatar")
|
||||
result = self.client_post("/json/users/me/avatar")
|
||||
self.assert_json_error(result, "You must upload exactly one avatar.")
|
||||
|
||||
correct_files = [
|
||||
@@ -705,7 +705,7 @@ class AvatarTest(UploadSerializeMixin, ZulipTestCase):
|
||||
# with self.subTest(fname=fname):
|
||||
self.login(self.example_email("hamlet"))
|
||||
with get_test_image_file(fname) as fp:
|
||||
result = self.client_put_multipart("/json/users/me/avatar", {'file': fp})
|
||||
result = self.client_post("/json/users/me/avatar", {'file': fp})
|
||||
|
||||
self.assert_json_success(result)
|
||||
json = ujson.loads(result.content)
|
||||
@@ -744,7 +744,7 @@ class AvatarTest(UploadSerializeMixin, ZulipTestCase):
|
||||
# with self.subTest(fname=fname):
|
||||
self.login(self.example_email("hamlet"))
|
||||
with get_test_image_file(fname) as fp:
|
||||
result = self.client_put_multipart("/json/users/me/avatar", {'file': fp})
|
||||
result = self.client_post("/json/users/me/avatar", {'file': fp})
|
||||
|
||||
self.assert_json_error(result, "Could not decode image; did you upload an image file?")
|
||||
user_profile = self.example_user('hamlet')
|
||||
@@ -776,7 +776,7 @@ class AvatarTest(UploadSerializeMixin, ZulipTestCase):
|
||||
self.login(self.example_email("hamlet"))
|
||||
with get_test_image_file(self.correct_files[0][0]) as fp:
|
||||
with self.settings(MAX_AVATAR_FILE_SIZE=0):
|
||||
result = self.client_put_multipart("/json/users/me/avatar", {'file': fp})
|
||||
result = self.client_post("/json/users/me/avatar", {'file': fp})
|
||||
self.assert_json_error(result, "Uploaded file is larger than the allowed limit of 0 MB")
|
||||
|
||||
def test_get_avatar_url_with_user_profile_lookup(self):
|
||||
|
||||
@@ -313,7 +313,7 @@ v1_api_and_json_patterns = [
|
||||
url(r'^users/me/enter-sends$', rest_dispatch,
|
||||
{'POST': 'zerver.views.user_settings.change_enter_sends'}),
|
||||
url(r'^users/me/avatar$', rest_dispatch,
|
||||
{'PUT': 'zerver.views.user_settings.set_avatar_backend',
|
||||
{'POST': 'zerver.views.user_settings.set_avatar_backend',
|
||||
'DELETE': 'zerver.views.user_settings.delete_avatar_backend'}),
|
||||
|
||||
# users/me/hotspots -> zerver.views.hotspots
|
||||
|
||||
Reference in New Issue
Block a user