mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
Move endpoints to use stream_id instead of stream_name in their URLs
- Change `stream_name` into `stream_id` on some API endpoints that use `stream_name` in their URLs to prevent confusion of `views` selection. For example: If the stream name is "foo/members", the URL would be trigger "^streams/(?P<stream_name>.*)/members$" and it would be confusing because we intend to use the endpoint with "^streams/(?P<stream_name>.*)$" regex. All stream-related endpoints now use stream id instead of stream name, except for a single endpoint that lets you convert stream names to stream ids. See https://github.com/zulip/zulip/issues/2930#issuecomment-269576231 - Add `get_stream_id()` method to Zulip API client, and change `get_subscribers()` method to comply with the new stream API (replace `stream_name` with `stream_id`). Fixes #2930.
This commit is contained in:
@@ -293,9 +293,9 @@ v1_api_and_json_patterns = [
|
||||
{'GET': 'zerver.views.streams.json_get_stream_id'}),
|
||||
|
||||
# GET returns "stream info" (undefined currently?), HEAD returns whether stream exists (200 or 404)
|
||||
url(r'^streams/(?P<stream_name>.*)/members$', rest_dispatch,
|
||||
url(r'^streams/(?P<stream_id>\d+)/members$', rest_dispatch,
|
||||
{'GET': 'zerver.views.streams.get_subscribers_backend'}),
|
||||
url(r'^streams/(?P<stream_name>.*)$', rest_dispatch,
|
||||
url(r'^streams/(?P<stream_id>\d+)$', rest_dispatch,
|
||||
{'HEAD': 'zerver.views.streams.stream_exists_backend',
|
||||
'GET': 'zerver.views.streams.stream_exists_backend',
|
||||
'PATCH': 'zerver.views.streams.update_stream_backend',
|
||||
|
||||
Reference in New Issue
Block a user