hipchat: Refactor code for building subscriptions.

This moves the filtering of invite-only into the caller, and also
adjusts the indentation.
This commit is contained in:
Tim Abbott
2019-01-09 16:17:54 -08:00
parent c34a8f2e69
commit 035138dd98
2 changed files with 20 additions and 25 deletions

View File

@@ -141,18 +141,14 @@ def build_public_stream_subscriptions(
return subscriptions
def build_private_stream_subscriptions(
def build_stream_subscriptions(
get_users: Callable[..., Set[int]],
zerver_recipient: List[ZerverFieldsT],
zerver_stream: List[ZerverFieldsT]) -> List[ZerverFieldsT]:
subscriptions = [] # type: List[ZerverFieldsT]
stream_ids = {
stream['id']
for stream in zerver_stream
if stream['invite_only']
}
stream_ids = {stream['id'] for stream in zerver_stream}
recipient_map = {
recipient['id']: recipient['type_id'] # recipient_id -> stream_id