Skip to content

Commit 597c00b

Browse files
committed
urls: Change the method for adding alert words from PUT to POST.
1 parent 3b43841 commit 597c00b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

static/js/alert_words_ui.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function add_alert_word(alert_word) {
4343

4444
var words_to_be_added = [alert_word];
4545

46-
channel.put({
46+
channel.post({
4747
url: '/json/users/me/alert_words',
4848
data: {alert_words: JSON.stringify(words_to_be_added)},
4949
success: function () {

zerver/tests/test_alert_words.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_internal_endpoint(self):
3939
params = {
4040
'alert_words': ujson.dumps(['milk', 'cookies'])
4141
}
42-
result = self.client_put('/json/users/me/alert_words', params)
42+
result = self.client_post('/json/users/me/alert_words', params)
4343
self.assert_json_success(result)
4444
user = self.example_user(user_name)
4545
words = user_alert_words(user)
@@ -119,7 +119,7 @@ def test_json_list_add(self):
119119
# type: () -> None
120120
self.login(self.example_email("hamlet"))
121121

122-
result = self.client_put('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one ', '\n two', 'three'])})
122+
result = self.client_post('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one ', '\n two', 'three'])})
123123
self.assert_json_success(result)
124124

125125
result = self.client_get('/json/users/me/alert_words')
@@ -130,7 +130,7 @@ def test_json_list_remove(self):
130130
# type: () -> None
131131
self.login(self.example_email("hamlet"))
132132

133-
result = self.client_put('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
133+
result = self.client_post('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
134134
self.assert_json_success(result)
135135

136136
result = self.client_delete('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one'])})
@@ -152,7 +152,7 @@ def test_alert_flags(self):
152152
self.login(self.example_email("hamlet"))
153153
user_profile_hamlet = self.example_user('hamlet')
154154

155-
result = self.client_put('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
155+
result = self.client_post('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
156156
self.assert_json_success(result)
157157

158158
result = self.client_get('/json/users/me/alert_words')
@@ -184,7 +184,7 @@ def test_update_alert_words(self):
184184
me_email = user_profile.email
185185

186186
self.login(me_email)
187-
result = self.client_put('/json/users/me/alert_words', {'alert_words': ujson.dumps(['ALERT'])})
187+
result = self.client_post('/json/users/me/alert_words', {'alert_words': ujson.dumps(['ALERT'])})
188188

189189
content = 'this is an ALERT for you'
190190
self.send_message(me_email, "Denmark", Recipient.STREAM, content)

zproject/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@
365365
# users/me/alert_words -> zerver.views.alert_words
366366
url(r'^users/me/alert_words$', rest_dispatch,
367367
{'GET': 'zerver.views.alert_words.list_alert_words',
368-
'PUT': 'zerver.views.alert_words.add_alert_words',
368+
'POST': 'zerver.views.alert_words.add_alert_words',
369369
'DELETE': 'zerver.views.alert_words.remove_alert_words'}),
370370

371371
# users/me/custom_profile_data -> zerver.views.custom_profile_data

0 commit comments

Comments
 (0)