mirror of https://github.com/zulip/zulip.git
Migrate json/set_muted_topics to muting/topics.
This commit is contained in:
parent
9500c88e32
commit
e5ab3123af
|
@ -96,7 +96,7 @@ exports.persist_and_rerender = function () {
|
||||||
};
|
};
|
||||||
last_topic_update = timestamp_ms();
|
last_topic_update = timestamp_ms();
|
||||||
channel.post({
|
channel.post({
|
||||||
url: '/json/set_muted_topics',
|
url: '/json/users/me/subscriptions/muted_topics',
|
||||||
idempotent: true,
|
idempotent: true,
|
||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,7 @@ class MutedTopicsTests(ZulipTestCase):
|
||||||
email = 'hamlet@zulip.com'
|
email = 'hamlet@zulip.com'
|
||||||
self.login(email)
|
self.login(email)
|
||||||
|
|
||||||
url = '/json/set_muted_topics'
|
url = '/json/users/me/subscriptions/muted_topics'
|
||||||
data = {'muted_topics': '[["stream", "topic"]]'}
|
data = {'muted_topics': '[["stream", "topic"]]'}
|
||||||
result = self.client_post(url, data)
|
result = self.client_post(url, data)
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
@ -24,7 +24,7 @@ class MutedTopicsTests(ZulipTestCase):
|
||||||
user = get_user_profile_by_email(email)
|
user = get_user_profile_by_email(email)
|
||||||
self.assertEqual(ujson.loads(user.muted_topics), [["stream", "topic"]])
|
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"]]'}
|
data = {'muted_topics': '[["stream2", "topic2"]]'}
|
||||||
result = self.client_post(url, data)
|
result = self.client_post(url, data)
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
|
|
@ -10,9 +10,8 @@ from zerver.lib.response import json_success
|
||||||
from zerver.lib.validator import check_string, check_list
|
from zerver.lib.validator import check_string, check_list
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
@authenticated_json_post_view
|
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def json_set_muted_topics(request, user_profile,
|
def set_muted_topics(request, user_profile,
|
||||||
muted_topics=REQ(validator=check_list(
|
muted_topics=REQ(validator=check_list(
|
||||||
check_list(check_string, length=2)), default=[])):
|
check_list(check_string, length=2)), default=[])):
|
||||||
# type: (HttpRequest, UserProfile, List[List[Text]]) -> HttpResponse
|
# type: (HttpRequest, UserProfile, List[List[Text]]) -> HttpResponse
|
||||||
|
|
|
@ -35,5 +35,4 @@ legacy_urls = [
|
||||||
url(r'^json/report_unnarrow_time$', zerver.views.report.json_report_unnarrow_time),
|
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/upload_file$', zerver.views.upload.json_upload_file),
|
||||||
url(r'^json/messages_in_narrow$', zerver.views.messages.json_messages_in_narrow),
|
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),
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -340,6 +340,9 @@ v1_api_and_json_patterns = [
|
||||||
'POST': 'zerver.views.streams.add_subscriptions_backend',
|
'POST': 'zerver.views.streams.add_subscriptions_backend',
|
||||||
'PATCH': 'zerver.views.streams.update_subscriptions_backend',
|
'PATCH': 'zerver.views.streams.update_subscriptions_backend',
|
||||||
'DELETE': 'zerver.views.streams.remove_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
|
# used to register for an event queue in tornado
|
||||||
url(r'^register$', rest_dispatch,
|
url(r'^register$', rest_dispatch,
|
||||||
|
|
Loading…
Reference in New Issue