mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +00:00
urls: Remove the old POST endpoint for alert words.
This commit is contained in:
committed by
Tim Abbott
parent
b17fecbf06
commit
ca687e01d7
@@ -39,7 +39,7 @@ class AlertWordTests(ZulipTestCase):
|
||||
params = {
|
||||
'alert_words': ujson.dumps(['milk', 'cookies'])
|
||||
}
|
||||
result = self.client_post('/json/users/me/alert_words', params)
|
||||
result = self.client_put('/json/users/me/alert_words', params)
|
||||
self.assert_json_success(result)
|
||||
user = self.example_user(user_name)
|
||||
words = user_alert_words(user)
|
||||
@@ -140,20 +140,6 @@ class AlertWordTests(ZulipTestCase):
|
||||
self.assert_json_success(result)
|
||||
self.assertEqual(result.json()['alert_words'], ['two', 'three'])
|
||||
|
||||
def test_json_list_set(self):
|
||||
# type: () -> None
|
||||
self.login(self.example_email("hamlet"))
|
||||
|
||||
result = self.client_put('/json/users/me/alert_words', {'alert_words': ujson.dumps(['one', 'two', 'three'])})
|
||||
self.assert_json_success(result)
|
||||
|
||||
result = self.client_post('/json/users/me/alert_words', {'alert_words': ujson.dumps(['a', 'b', 'c'])})
|
||||
self.assert_json_success(result)
|
||||
|
||||
result = self.client_get('/json/users/me/alert_words')
|
||||
self.assert_json_success(result)
|
||||
self.assertEqual(result.json()['alert_words'], ['a', 'b', 'c'])
|
||||
|
||||
def message_does_alert(self, user_profile, message):
|
||||
# type: (UserProfile, Text) -> bool
|
||||
"""Send a bunch of messages as othello, so Hamlet is notified"""
|
||||
|
||||
@@ -9,7 +9,7 @@ from zerver.decorator import has_request_variables, REQ
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.validator import check_list, check_string
|
||||
|
||||
from zerver.lib.actions import do_add_alert_words, do_remove_alert_words, do_set_alert_words
|
||||
from zerver.lib.actions import do_add_alert_words, do_remove_alert_words
|
||||
from zerver.lib.alert_words import user_alert_words
|
||||
|
||||
def list_alert_words(request, user_profile):
|
||||
@@ -21,13 +21,6 @@ def clean_alert_words(alert_words):
|
||||
alert_words = [w.strip() for w in alert_words]
|
||||
return [w for w in alert_words if w != ""]
|
||||
|
||||
@has_request_variables
|
||||
def set_alert_words(request, user_profile,
|
||||
alert_words=REQ(validator=check_list(check_string), default=[])):
|
||||
# type: (HttpRequest, UserProfile, List[Text]) -> HttpResponse
|
||||
do_set_alert_words(user_profile, clean_alert_words(alert_words))
|
||||
return json_success()
|
||||
|
||||
@has_request_variables
|
||||
def add_alert_words(request, user_profile,
|
||||
alert_words=REQ(validator=check_list(check_string), default=[])):
|
||||
|
||||
@@ -365,7 +365,6 @@ v1_api_and_json_patterns = [
|
||||
# users/me/alert_words -> zerver.views.alert_words
|
||||
url(r'^users/me/alert_words$', rest_dispatch,
|
||||
{'GET': 'zerver.views.alert_words.list_alert_words',
|
||||
'POST': 'zerver.views.alert_words.set_alert_words',
|
||||
'PUT': 'zerver.views.alert_words.add_alert_words',
|
||||
'DELETE': 'zerver.views.alert_words.remove_alert_words'}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user