Migrate json/set_muted_topics to muting/topics.

This commit is contained in:
Amy Liu 2017-01-09 16:23:53 -08:00 committed by Tim Abbott
parent 9500c88e32
commit e5ab3123af
5 changed files with 9 additions and 8 deletions

View File

@ -96,7 +96,7 @@ exports.persist_and_rerender = function () {
};
last_topic_update = timestamp_ms();
channel.post({
url: '/json/set_muted_topics',
url: '/json/users/me/subscriptions/muted_topics',
idempotent: true,
data: data,
});

View File

@ -16,7 +16,7 @@ class MutedTopicsTests(ZulipTestCase):
email = 'hamlet@zulip.com'
self.login(email)
url = '/json/set_muted_topics'
url = '/json/users/me/subscriptions/muted_topics'
data = {'muted_topics': '[["stream", "topic"]]'}
result = self.client_post(url, data)
self.assert_json_success(result)
@ -24,7 +24,7 @@ class MutedTopicsTests(ZulipTestCase):
user = get_user_profile_by_email(email)
self.assertEqual(ujson.loads(user.muted_topics), [["stream", "topic"]])
url = '/json/set_muted_topics'
url = '/json/users/me/subscriptions/muted_topics'
data = {'muted_topics': '[["stream2", "topic2"]]'}
result = self.client_post(url, data)
self.assert_json_success(result)

View File

@ -10,9 +10,8 @@ from zerver.lib.response import json_success
from zerver.lib.validator import check_string, check_list
from zerver.models import UserProfile
@authenticated_json_post_view
@has_request_variables
def json_set_muted_topics(request, user_profile,
def set_muted_topics(request, user_profile,
muted_topics=REQ(validator=check_list(
check_list(check_string, length=2)), default=[])):
# type: (HttpRequest, UserProfile, List[List[Text]]) -> HttpResponse

View File

@ -35,5 +35,4 @@ legacy_urls = [
url(r'^json/report_unnarrow_time$', zerver.views.report.json_report_unnarrow_time),
url(r'^json/upload_file$', zerver.views.upload.json_upload_file),
url(r'^json/messages_in_narrow$', zerver.views.messages.json_messages_in_narrow),
url(r'^json/set_muted_topics$', zerver.views.muting.json_set_muted_topics),
]

View File

@ -340,6 +340,9 @@ v1_api_and_json_patterns = [
'POST': 'zerver.views.streams.add_subscriptions_backend',
'PATCH': 'zerver.views.streams.update_subscriptions_backend',
'DELETE': 'zerver.views.streams.remove_subscriptions_backend'}),
# muting -> zerver.views.muting
url(r'^users/me/subscriptions/muted_topics$', rest_dispatch,
{'POST': 'zerver.views.muting.set_muted_topics'}),
# used to register for an event queue in tornado
url(r'^register$', rest_dispatch,