mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 06:58:31 +00:00
Replace json/set_alert_words with REST style route.
This commit is contained in:
@@ -11,7 +11,7 @@ function update_word_alerts() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
channel.post({
|
channel.post({
|
||||||
url: '/json/set_alert_words',
|
url: '/json/users/me/alert_words',
|
||||||
idempotent: true,
|
idempotent: true,
|
||||||
data: {alert_words: JSON.stringify(words)}});
|
data: {alert_words: JSON.stringify(words)}});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1219,7 +1219,7 @@ class AlertWordTests(AuthedTestCase):
|
|||||||
params = {
|
params = {
|
||||||
'alert_words': ujson.dumps(['milk', 'cookies'])
|
'alert_words': ujson.dumps(['milk', 'cookies'])
|
||||||
}
|
}
|
||||||
result = self.client.post('/json/set_alert_words', params)
|
result = self.client.post('/json/users/me/alert_words', params)
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
user = get_user_profile_by_email(email)
|
user = get_user_profile_by_email(email)
|
||||||
words = user_alert_words(user)
|
words = user_alert_words(user)
|
||||||
@@ -1303,7 +1303,7 @@ class AlertWordTests(AuthedTestCase):
|
|||||||
def test_json_list_add(self):
|
def test_json_list_add(self):
|
||||||
self.login("hamlet@zulip.com")
|
self.login("hamlet@zulip.com")
|
||||||
|
|
||||||
result = self.client_patch('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
|
result = self.client_put('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
|
||||||
|
|
||||||
@@ -1315,7 +1315,7 @@ class AlertWordTests(AuthedTestCase):
|
|||||||
def test_json_list_remove(self):
|
def test_json_list_remove(self):
|
||||||
self.login("hamlet@zulip.com")
|
self.login("hamlet@zulip.com")
|
||||||
|
|
||||||
result = self.client_patch('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
|
result = self.client_put('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
|
||||||
result = self.client_delete('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one'])})
|
result = self.client_delete('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one'])})
|
||||||
@@ -1329,10 +1329,10 @@ class AlertWordTests(AuthedTestCase):
|
|||||||
def test_json_list_set(self):
|
def test_json_list_set(self):
|
||||||
self.login("hamlet@zulip.com")
|
self.login("hamlet@zulip.com")
|
||||||
|
|
||||||
result = self.client_patch('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
|
result = self.client_put('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
|
||||||
result = self.client_put('/json/users/me/alert_words', {'alert_words': ujson.dumps(['a', 'b', 'c'])})
|
result = self.client.post('/json/users/me/alert_words', {'alert_words': ujson.dumps(['a', 'b', 'c'])})
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
|
||||||
result = self.client.get('/json/users/me/alert_words')
|
result = self.client.get('/json/users/me/alert_words')
|
||||||
@@ -1350,7 +1350,7 @@ class AlertWordTests(AuthedTestCase):
|
|||||||
self.login("hamlet@zulip.com")
|
self.login("hamlet@zulip.com")
|
||||||
user_profile_hamlet = get_user_profile_by_email("hamlet@zulip.com")
|
user_profile_hamlet = get_user_profile_by_email("hamlet@zulip.com")
|
||||||
|
|
||||||
result = self.client_patch('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
|
result = self.client_put('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
|
||||||
result = self.client.get('/json/users/me/alert_words')
|
result = self.client.get('/json/users/me/alert_words')
|
||||||
|
|||||||
@@ -226,8 +226,8 @@ v1_api_and_json_patterns = patterns('zerver.views',
|
|||||||
) + patterns('zerver.views.alert_words',
|
) + patterns('zerver.views.alert_words',
|
||||||
url(r'^users/me/alert_words$', 'rest_dispatch',
|
url(r'^users/me/alert_words$', 'rest_dispatch',
|
||||||
{'GET': 'list_alert_words',
|
{'GET': 'list_alert_words',
|
||||||
'PUT': 'set_alert_words',
|
'POST': 'set_alert_words',
|
||||||
'PATCH': 'add_alert_words',
|
'PUT': 'add_alert_words',
|
||||||
'DELETE': 'remove_alert_words'}),
|
'DELETE': 'remove_alert_words'}),
|
||||||
|
|
||||||
) + patterns('zerver.views.user_settings',
|
) + patterns('zerver.views.user_settings',
|
||||||
|
|||||||
Reference in New Issue
Block a user