mirror of https://github.com/zulip/zulip.git
[manual] API get_public_streams: Return streams in a dictionary.
This way we can return properties of the streams other than just their names in future versions of the API without breaking old clients. The manual step required is to deploy the updated version of sync-public-streams on zmirror.humbughq.com when we deploy this code to prod. (imported from commit 42b86d8daa5729f52c9961dd912c5776a25ab0b4)
This commit is contained in:
parent
45c692c1e0
commit
9924faaabd
|
@ -27,9 +27,10 @@ def fetch_public_streams():
|
|||
return None
|
||||
|
||||
for stream in streams:
|
||||
stream_name = stream["name"]
|
||||
# Zephyr class names are canonicalized by first applying NFKC
|
||||
# normalization and then lower-casing server-side
|
||||
canonical_cls = unicodedata.normalize("NFKC", stream).lower().encode("utf-8")
|
||||
canonical_cls = unicodedata.normalize("NFKC", stream_name).lower().encode("utf-8")
|
||||
if canonical_cls in ['security', 'login', 'network', 'ops', 'user_locate',
|
||||
'mit',
|
||||
'hm_ctl', 'hm_stat', 'zephyr_admin', 'zephyr_ctl']:
|
||||
|
|
|
@ -542,7 +542,9 @@ exports.setup_page = function () {
|
|||
/* arguments are [ "success", statusText, jqXHR ] */
|
||||
if (stream_data.length > 2 && stream_data[2]) {
|
||||
var stream_response = JSON.parse(stream_data[2].responseText);
|
||||
all_streams = stream_response.streams;
|
||||
$.each(stream_response.streams, function(idx, stream) {
|
||||
all_streams.push(stream.name);
|
||||
});
|
||||
}
|
||||
if (subscription_data.length > 2 && subscription_data[2]) {
|
||||
var subs_response = JSON.parse(subscription_data[2].responseText);
|
||||
|
|
|
@ -1181,7 +1181,7 @@ def get_public_streams_backend(request, user_profile):
|
|||
subs_filter = Subscription.objects.filter(active=True).values('recipient_id')
|
||||
stream_ids = Recipient.objects.filter(
|
||||
type=Recipient.STREAM, id__in=subs_filter).values('type_id')
|
||||
streams = sorted(stream.name for stream in
|
||||
streams = sorted({"name": stream.name} for stream in
|
||||
Stream.objects.filter(id__in = stream_ids,
|
||||
realm=user_profile.realm,
|
||||
invite_only=False))
|
||||
|
|
Loading…
Reference in New Issue