Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

backend: Change return value of `compose_views`.

Lauryn Menarddbddbee5a115
diff --git a/zerver/views/streams.py b/zerver/views/streams.py
index c878f5325e1..d1b83a34d33 100644
--- a/zerver/views/streams.py
+++ b/zerver/views/streams.py
@@ -374,10 +374,12 @@ def update_subscriptions_backend(
lambda: add_subscriptions_backend(request, user_profile, streams_raw=add),
lambda: remove_subscriptions_backend(request, user_profile, streams_raw=delete),
]
- return compose_views(thunks)
+ data = compose_views(thunks)
+ return json_success(data)
-def compose_views(thunks: List[Callable[[], HttpResponse]]) -> HttpResponse:
+
+def compose_views(thunks: List[Callable[[], HttpResponse]]) -> Dict[str, Any]:
"""
This takes a series of thunks and calls them in sequence, and it
smushes all the json results into a single response when
@@ -391,7 +393,7 @@ def compose_views(thunks: List[Callable[[], HttpResponse]]) -> HttpResponse:
for thunk in thunks:
response = thunk()
json_dict.update(orjson.loads(response.content))
- return json_success(json_dict)
+ return json_dict
check_principals: Validator[Union[List[str], List[int]]] = check_union(
diff --git a/zerver/views/user_groups.py b/zerver/views/user_groups.py
index b4dc2a04aaa..bc9a0206202 100644
--- a/zerver/views/user_groups.py
+++ b/zerver/views/user_groups.py
@@ -103,7 +103,9 @@ def update_user_group_backend(
request, user_profile, user_group_id=user_group_id, members=delete
),
]
- return compose_views(thunks)
+ data = compose_views(thunks)
+
+ return json_success(data)
def add_members_to_group_backend(