Replace /json/subscriptions/add usage with /json/users/me/subscription.

This commit is contained in:
Allie Jones
2015-11-30 15:39:40 -05:00
committed by Tim Abbott
parent 023f45190f
commit 29a4b51e52
4 changed files with 13 additions and 13 deletions

View File

@@ -11,7 +11,7 @@ var exports = {};
function add_sub(stream_name, $status_message) {
channel.post({
url: '/json/subscriptions/add',
url: '/users/me/subscriptions',
data: {
subscriptions: JSON.stringify([{'name': stream_name}])
}

View File

@@ -548,7 +548,7 @@ function ajaxSubscribe(stream) {
var true_stream_name;
return channel.post({
url: "/json/subscriptions/add",
url: "/json/users/me/subscriptions",
data: {"subscriptions": JSON.stringify([{"name": stream}]) },
success: function (resp, statusText, xhr, form) {
$("#create_stream_name").val("");
@@ -588,7 +588,7 @@ function ajaxUnsubscribe(stream) {
function ajaxSubscribeForCreation(stream, principals, invite_only, announce) {
// Subscribe yourself and possible other people to a new stream.
return channel.post({
url: "/json/subscriptions/add",
url: "/json/users/me/subscriptions",
data: {"subscriptions": JSON.stringify([{"name": stream}]),
"principals": JSON.stringify(principals),
"invite_only": JSON.stringify(invite_only),
@@ -642,7 +642,7 @@ function show_new_stream_modal() {
exports.invite_user_to_stream = function (user_email, stream_name, success, failure) {
return channel.post({
url: "/json/subscriptions/add",
url: "/json/users/me/subscriptions",
data: {"subscriptions": JSON.stringify([{"name": stream_name}]),
"principals": JSON.stringify([user_email])},
success: success,

View File

@@ -69,10 +69,10 @@ class PublicURLTest(TestCase):
"/json/settings/change",
"/json/subscriptions/remove",
"/json/subscriptions/exists",
"/json/subscriptions/add",
"/json/subscriptions/property",
"/json/get_subscribers",
"/json/fetch_api_key",
"/json/users/me/subscriptions",
"/api/v1/users/me/subscriptions",
],
400: ["/api/v1/send_message",

View File

@@ -262,7 +262,7 @@ class StreamAdminTest(AuthedTestCase):
# Even if you could guess the new name, you can't subscribe to it.
result = self.client.post(
"/json/subscriptions/add",
"/json/users/me/subscriptions",
{"subscriptions": ujson.dumps([{"name": deactivated_stream_name}])})
self.assert_json_error(
result, "Unable to access stream (%s)." % (deactivated_stream_name,))
@@ -708,7 +708,7 @@ class SubscriptionAPITest(AuthedTestCase):
def test_successful_subscriptions_add(self):
"""
Calling /json/subscriptions/add should successfully add streams, and
Calling POST /json/users/me/subscriptions should successfully add streams, and
should determine which are new subscriptions vs which were already
subscribed. We randomly generate stream names to add, because it
doesn't matter whether the stream already exists.
@@ -724,7 +724,7 @@ class SubscriptionAPITest(AuthedTestCase):
def test_successful_subscriptions_notifies_pm(self):
"""
Calling /json/subscriptions/add should notify when a new stream is created.
Calling POST /json/users/me/subscriptions should notify when a new stream is created.
"""
invitee = "iago@zulip.com"
invitee_full_name = 'Iago'
@@ -753,7 +753,7 @@ class SubscriptionAPITest(AuthedTestCase):
def test_successful_subscriptions_notifies_stream(self):
"""
Calling /json/subscriptions/add should notify when a new stream is created.
Calling POST /json/users/me/subscriptions should notify when a new stream is created.
"""
invitee = "iago@zulip.com"
invitee_full_name = 'Iago'
@@ -791,7 +791,7 @@ class SubscriptionAPITest(AuthedTestCase):
def test_successful_subscriptions_notifies_with_escaping(self):
"""
Calling /json/subscriptions/add should notify when a new stream is created.
Calling POST /json/users/me/subscriptions should notify when a new stream is created.
"""
invitee = "iago@zulip.com"
invitee_full_name = 'Iago'
@@ -825,7 +825,7 @@ class SubscriptionAPITest(AuthedTestCase):
def test_subscriptions_add_too_long(self):
"""
Calling /json/subscriptions/add on a stream whose name is >60
Calling POST /json/users/me/subscriptions on a stream whose name is >60
characters should return a JSON error.
"""
# character limit is 60 characters
@@ -845,7 +845,7 @@ class SubscriptionAPITest(AuthedTestCase):
def test_subscriptions_add_invalid_stream(self):
"""
Calling /json/subscriptions/add on a stream whose name is invalid (as
Calling POST /json/users/me/subscriptions on a stream whose name is invalid (as
defined by valid_stream_name in zerver/views.py) should return a JSON
error.
"""
@@ -857,7 +857,7 @@ class SubscriptionAPITest(AuthedTestCase):
def assert_adding_subscriptions_for_principal(self, invitee, streams, invite_only=False):
"""
Calling /json/subscriptions/add on behalf of another principal (for
Calling POST /json/users/me/subscriptions on behalf of another principal (for
whom you have permission to add subscriptions) should successfully add
those subscriptions and send a message to the subscribee notifying
them.