mirror of https://github.com/zulip/zulip.git
[manual] Uniformize the subscriptions API method names.
This requires a zephyr_mirror deployment when it is pushed to prod. (imported from commit 6543441fb264b518f8705d7989d068a1d50ce5d6)
This commit is contained in:
parent
b251d064f9
commit
afc62a8e16
|
@ -495,7 +495,7 @@ def add_humbug_subscriptions(verbose):
|
|||
zephyr_subscriptions.add(cls)
|
||||
|
||||
if len(zephyr_subscriptions) != 0:
|
||||
res = humbug_client.subscribe(list(zephyr_subscriptions))
|
||||
res = humbug_client.add_subscriptions(list(zephyr_subscriptions))
|
||||
if res.get("result") != "success":
|
||||
print "Error subscribing to streams:"
|
||||
print res["msg"]
|
||||
|
|
|
@ -103,12 +103,12 @@ class HumbugAPI():
|
|||
def get_public_streams(self, request = {}):
|
||||
return self.do_api_query(request, "/api/v1/get_public_streams")
|
||||
|
||||
def get_subscriptions(self, request = {}):
|
||||
return self.do_api_query(request, "/api/v1/get_subscriptions")
|
||||
def list_subscriptions(self, request = {}):
|
||||
return self.do_api_query(request, "/api/v1/subscriptions/list")
|
||||
|
||||
def subscribe(self, streams):
|
||||
def add_subscriptions(self, streams):
|
||||
request = {'streams': streams}
|
||||
return self.do_api_query(request, "/api/v1/subscribe")
|
||||
return self.do_api_query(request, "/api/v1/subscriptions/add")
|
||||
|
||||
def call_on_each_message(self, callback, options = {}):
|
||||
max_message_id = None
|
||||
|
|
|
@ -3,11 +3,11 @@ import sys
|
|||
import os
|
||||
import optparse
|
||||
|
||||
usage = """get-subscriptions --user=<email address> [options]
|
||||
usage = """list-subscriptions --user=<email address> [options]
|
||||
|
||||
Prints out a list of the user's subscriptions.
|
||||
|
||||
Example: get-subscriptions --user=tabbott@humbughq.com --site=http://127.0.0.1:8000
|
||||
Example: list-subscriptions --user=tabbott@humbughq.com --site=http://127.0.0.1:8000
|
||||
"""
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option('--site',
|
||||
|
@ -30,4 +30,4 @@ client = api.common.HumbugAPI(email=options.user,
|
|||
verbose=True,
|
||||
site=options.site)
|
||||
|
||||
print client.get_subscriptions()
|
||||
print client.list_subscriptions()
|
|
@ -38,4 +38,4 @@ if options.streams == "":
|
|||
print >>sys.stderr, "Usage:", parser.usage
|
||||
sys.exit(1)
|
||||
|
||||
print client.subscribe(options.streams.split())
|
||||
print client.add_subscriptions(options.streams.split())
|
||||
|
|
|
@ -40,7 +40,7 @@ urlpatterns = patterns('',
|
|||
url(r'^json/send_message$', 'zephyr.views.json_send_message'),
|
||||
url(r'^json/settings/change$', 'zephyr.views.json_change_settings'),
|
||||
url(r'^json/subscriptions/list$', 'zephyr.views.json_list_subscriptions'),
|
||||
url(r'^json/subscriptions/remove$', 'zephyr.views.json_remove_subscription'),
|
||||
url(r'^json/subscriptions/remove$', 'zephyr.views.json_remove_subscriptions'),
|
||||
url(r'^json/subscriptions/add$', 'zephyr.views.json_add_subscriptions'),
|
||||
url(r'^json/subscriptions/exists$', 'zephyr.views.json_stream_exists'),
|
||||
url(r'^json/fetch_api_key$', 'zephyr.views.json_fetch_api_key'),
|
||||
|
@ -50,8 +50,8 @@ urlpatterns = patterns('',
|
|||
url(r'^api/v1/get_messages$', 'zephyr.views.api_get_messages'),
|
||||
url(r'^api/v1/get_old_messages$', 'zephyr.views.api_get_old_messages'),
|
||||
url(r'^api/v1/get_public_streams$', 'zephyr.views.api_get_public_streams'),
|
||||
url(r'^api/v1/get_subscriptions$', 'zephyr.views.api_get_subscriptions'),
|
||||
url(r'^api/v1/subscribe$', 'zephyr.views.api_subscribe'),
|
||||
url(r'^api/v1/subscriptions/list$', 'zephyr.views.api_list_subscriptions'),
|
||||
url(r'^api/v1/subscriptions/add$', 'zephyr.views.api_add_subscriptions'),
|
||||
url(r'^api/v1/send_message$', 'zephyr.views.api_send_message'),
|
||||
url(r'^api/v1/update_pointer$', 'zephyr.views.api_update_pointer'),
|
||||
|
||||
|
|
|
@ -121,8 +121,8 @@ class PublicURLTest(TestCase):
|
|||
302: ["/", "/accounts/logout/"],
|
||||
400: ["/accounts/register/",
|
||||
"/api/v1/get_public_streams",
|
||||
"/api/v1/get_subscriptions",
|
||||
"/api/v1/subscribe",
|
||||
"/api/v1/subscriptions/list",
|
||||
"/api/v1/subscriptions/add",
|
||||
"/api/v1/send_message",
|
||||
"/api/v1/fetch_api_key",
|
||||
"/json/fetch_api_key",
|
||||
|
|
|
@ -701,7 +701,7 @@ def gather_subscriptions(user_profile):
|
|||
if sub.recipient.type == Recipient.STREAM)
|
||||
|
||||
@authenticated_api_view
|
||||
def api_get_subscriptions(request, user_profile):
|
||||
def api_list_subscriptions(request, user_profile):
|
||||
return json_success({"streams": gather_subscriptions(user_profile)})
|
||||
|
||||
@authenticated_json_view
|
||||
|
@ -710,8 +710,8 @@ def json_list_subscriptions(request, user_profile):
|
|||
|
||||
@authenticated_json_view
|
||||
@has_request_variables
|
||||
def json_remove_subscription(request, user_profile,
|
||||
sub_name=POST("subscription")):
|
||||
def json_remove_subscriptions(request, user_profile,
|
||||
sub_name=POST("subscription")):
|
||||
stream = get_stream(sub_name, user_profile.realm)
|
||||
if not stream:
|
||||
return json_error("Stream does not exist")
|
||||
|
@ -725,7 +725,7 @@ def valid_stream_name(name):
|
|||
return name != ""
|
||||
|
||||
@authenticated_api_view
|
||||
def api_subscribe(request, user_profile):
|
||||
def api_add_subscriptions(request, user_profile):
|
||||
return add_subscriptions_backend(request, user_profile)
|
||||
|
||||
@authenticated_json_view
|
||||
|
|
Loading…
Reference in New Issue