From 0366659beea76766dea12a1e834402a94553a3f0 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Wed, 5 Feb 2014 15:56:29 -0500 Subject: [PATCH] Return stream_id in /json/get_public_streams. (imported from commit 985d4e01bd3b589d10e57886d159cfdabe594dd4) --- zerver/views/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/zerver/views/__init__.py b/zerver/views/__init__.py index 89cee31b90..24a05a2dcd 100644 --- a/zerver/views/__init__.py +++ b/zerver/views/__init__.py @@ -1093,9 +1093,16 @@ def get_streams_backend(request, user_profile, # We're including nothing, so don't bother hitting the DB. query = [] - streams = sorted([{"name": stream.name, "description": stream.description, - "invite_only": stream.invite_only} for stream in query], - key=lambda elt: elt["name"]) + def make_dict(row): + return dict( + stream_id = row.id, + name = row.name, + description = row.description, + invite_only = row.invite_only, + ) + + streams = [make_dict(row) for row in query] + streams.sort(key=lambda elt: elt["name"]) return json_success({"streams": streams})