mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
default_streams: Remove get_default_streams_for_realm_as_dicts.
Since get_default_streams_for_realm_as_dicts function was only used in tests, this commit removes it and updates the test to use the function which returns Stream objects instead of dicts. This commit also removes Stream.to_dict function which is no longer used.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
from zerver.lib.types import DefaultStreamDict
|
||||
from zerver.models import DefaultStream, Stream
|
||||
|
||||
|
||||
@@ -18,13 +17,3 @@ def get_slim_realm_default_streams(realm_id: int) -> list[Stream]:
|
||||
|
||||
def get_default_stream_ids_for_realm(realm_id: int) -> set[int]:
|
||||
return set(DefaultStream.objects.filter(realm_id=realm_id).values_list("stream_id", flat=True))
|
||||
|
||||
|
||||
def get_default_streams_for_realm_as_dicts(realm_id: int) -> list[DefaultStreamDict]:
|
||||
"""
|
||||
Return all the default streams for a realm using a list of dictionaries sorted
|
||||
by stream name.
|
||||
"""
|
||||
streams = get_slim_realm_default_streams(realm_id)
|
||||
stream_dicts = [stream.to_dict() for stream in streams]
|
||||
return sorted(stream_dicts, key=lambda stream: stream["name"])
|
||||
|
||||
Reference in New Issue
Block a user