Rename not_subscribed key to not_removed in users/me/subscriptions.

Rename `not_subscibed_key` to `not_removed` in
`users/me/subscriptions` DELETE response.

Fixes #13277.
This commit is contained in:
Rafid Aslam
2019-10-13 10:30:34 +07:00
parent dfd9ace7fa
commit 718b70ec8b
5 changed files with 12 additions and 12 deletions

View File

@@ -69,7 +69,7 @@ administrative privileges.
* `removed`: A list of the names of streams which were unsubscribed from as * `removed`: A list of the names of streams which were unsubscribed from as
a result of the query. a result of the query.
* `not_subscribed`: A list of the names of streams that the user is already * `not_removed`: A list of the names of streams that the user is already
unsubscribed from, and hence doesn't need to be unsubscribed. unsubscribed from, and hence doesn't need to be unsubscribed.
#### Example response #### Example response

View File

@@ -1629,7 +1629,7 @@ paths:
allOf: allOf:
- $ref: '#/components/schemas/JsonSuccess' - $ref: '#/components/schemas/JsonSuccess'
- properties: - properties:
not_subscribed: not_removed:
type: array type: array
items: items:
type: string type: string
@@ -1645,7 +1645,7 @@ paths:
- example: - example:
{ {
"msg": "", "msg": "",
"not_subscribed": [], "not_removed": [],
"removed": [ "removed": [
"new stream" "new stream"
], ],

View File

@@ -126,7 +126,7 @@ class DocPageTest(ZulipTestCase):
self._test('/api/get-profile', 'takes no arguments') self._test('/api/get-profile', 'takes no arguments')
self._test('/api/add-subscriptions', 'authorization_errors_fatal') self._test('/api/add-subscriptions', 'authorization_errors_fatal')
self._test('/api/create-user', 'zuliprc-admin') self._test('/api/create-user', 'zuliprc-admin')
self._test('/api/remove-subscriptions', 'not_subscribed') self._test('/api/remove-subscriptions', 'not_removed')
self._test('/team/', 'industry veterans') self._test('/team/', 'industry veterans')
self._test('/history/', 'Cambridge, Massachusetts') self._test('/history/', 'Cambridge, Massachusetts')
# Test the i18n version of one of these pages. # Test the i18n version of one of these pages.

View File

@@ -991,7 +991,7 @@ class StreamAdminTest(ZulipTestCase):
other_user_subbed=True) other_user_subbed=True)
json = self.assert_json_success(result) json = self.assert_json_success(result)
self.assertEqual(len(json["removed"]), 1) self.assertEqual(len(json["removed"]), 1)
self.assertEqual(len(json["not_subscribed"]), 0) self.assertEqual(len(json["not_removed"]), 0)
def test_admin_remove_others_from_subbed_private_stream(self) -> None: def test_admin_remove_others_from_subbed_private_stream(self) -> None:
""" """
@@ -1003,7 +1003,7 @@ class StreamAdminTest(ZulipTestCase):
other_user_subbed=True) other_user_subbed=True)
json = self.assert_json_success(result) json = self.assert_json_success(result)
self.assertEqual(len(json["removed"]), 1) self.assertEqual(len(json["removed"]), 1)
self.assertEqual(len(json["not_subscribed"]), 0) self.assertEqual(len(json["not_removed"]), 0)
def test_admin_remove_others_from_unsubbed_private_stream(self) -> None: def test_admin_remove_others_from_unsubbed_private_stream(self) -> None:
""" """
@@ -1015,7 +1015,7 @@ class StreamAdminTest(ZulipTestCase):
other_user_subbed=True, other_sub_users=[self.example_user("othello")]) other_user_subbed=True, other_sub_users=[self.example_user("othello")])
json = self.assert_json_success(result) json = self.assert_json_success(result)
self.assertEqual(len(json["removed"]), 1) self.assertEqual(len(json["removed"]), 1)
self.assertEqual(len(json["not_subscribed"]), 0) self.assertEqual(len(json["not_removed"]), 0)
def test_create_stream_policy_setting(self) -> None: def test_create_stream_policy_setting(self) -> None:
""" """
@@ -1155,7 +1155,7 @@ class StreamAdminTest(ZulipTestCase):
other_user_subbed=False) other_user_subbed=False)
json = self.assert_json_success(result) json = self.assert_json_success(result)
self.assertEqual(len(json["removed"]), 0) self.assertEqual(len(json["removed"]), 0)
self.assertEqual(len(json["not_subscribed"]), 1) self.assertEqual(len(json["not_removed"]), 1)
def test_remove_invalid_user(self) -> None: def test_remove_invalid_user(self) -> None:
""" """
@@ -2839,7 +2839,7 @@ class SubscriptionAPITest(ZulipTestCase):
{"msg": "", {"msg": "",
"removed": ["Denmark", "Scotland", "Verona"], "removed": ["Denmark", "Scotland", "Verona"],
"not_subscribed": ["Rome"], "result": "success"} "not_removed": ["Rome"], "result": "success"}
""" """
result = self.client_delete("/json/users/me/subscriptions", result = self.client_delete("/json/users/me/subscriptions",
{"subscriptions": ujson.dumps(subscriptions)}) {"subscriptions": ujson.dumps(subscriptions)})
@@ -2868,7 +2868,7 @@ class SubscriptionAPITest(ZulipTestCase):
try_to_remove = not_subbed[:3] # attempt to remove up to 3 streams not already subbed to try_to_remove = not_subbed[:3] # attempt to remove up to 3 streams not already subbed to
streams_to_remove.extend(try_to_remove) streams_to_remove.extend(try_to_remove)
self.helper_check_subs_before_and_after_remove(streams_to_remove, self.helper_check_subs_before_and_after_remove(streams_to_remove,
{"removed": self.streams[1:], "not_subscribed": try_to_remove}, {"removed": self.streams[1:], "not_removed": try_to_remove},
self.test_email, [self.streams[0]], self.test_realm) self.test_email, [self.streams[0]], self.test_realm)
def test_subscriptions_remove_fake_stream(self) -> None: def test_subscriptions_remove_fake_stream(self) -> None:

View File

@@ -257,7 +257,7 @@ def remove_subscriptions_backend(
else: else:
people_to_unsub = set([user_profile]) people_to_unsub = set([user_profile])
result = dict(removed=[], not_subscribed=[]) # type: Dict[str, List[str]] result = dict(removed=[], not_removed=[]) # type: Dict[str, List[str]]
(removed, not_subscribed) = bulk_remove_subscriptions(people_to_unsub, streams, (removed, not_subscribed) = bulk_remove_subscriptions(people_to_unsub, streams,
request.client, request.client,
acting_user=user_profile) acting_user=user_profile)
@@ -265,7 +265,7 @@ def remove_subscriptions_backend(
for (subscriber, removed_stream) in removed: for (subscriber, removed_stream) in removed:
result["removed"].append(removed_stream.name) result["removed"].append(removed_stream.name)
for (subscriber, not_subscribed_stream) in not_subscribed: for (subscriber, not_subscribed_stream) in not_subscribed:
result["not_subscribed"].append(not_subscribed_stream.name) result["not_removed"].append(not_subscribed_stream.name)
return json_success(result) return json_success(result)