mirror of https://github.com/zulip/zulip.git
Don't try to show all streams on the subscriptions page for the MIT realm
The query fails anyway, so this is not a safety check. This commit makes it so that MIT users actually see their subscriptions instead of an error. (imported from commit ee635943728d7d9823e118d9fa51c402b1cd9bf2)
This commit is contained in:
parent
3250e83e66
commit
6082222a68
|
@ -28,6 +28,10 @@ function should_render_subscribers() {
|
|||
return domain !== 'mit.edu';
|
||||
}
|
||||
|
||||
function should_list_all_streams() {
|
||||
return domain !== 'mit.edu';
|
||||
}
|
||||
|
||||
function update_table_stream_color(table, stream_name, color) {
|
||||
$.each(table.find(".stream_label"), function () {
|
||||
if ($(this).text() === stream_name) {
|
||||
|
@ -207,6 +211,29 @@ exports.setup_page = function () {
|
|||
$('#streams').focus().select();
|
||||
}
|
||||
|
||||
if (should_list_all_streams()) {
|
||||
// This query must go first to prevent a race when we are not
|
||||
// listing all streams
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/json/get_public_streams',
|
||||
dataType: 'json',
|
||||
timeout: 10*1000,
|
||||
success: function (data) {
|
||||
if (data) {
|
||||
all_streams = data.streams;
|
||||
maybe_populate_subscriptions();
|
||||
}
|
||||
},
|
||||
error: function (xhr) {
|
||||
util.destroy_loading_indicator($('#subs_page_loading_indicator'));
|
||||
ui.report_error("Error listing subscriptions", xhr, $("#subscriptions-status"));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
all_streams = [];
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/json/subscriptions/list',
|
||||
|
@ -223,23 +250,6 @@ exports.setup_page = function () {
|
|||
ui.report_error("Error listing subscriptions", xhr, $("#subscriptions-status"));
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/json/get_public_streams',
|
||||
dataType: 'json',
|
||||
timeout: 10*1000,
|
||||
success: function (data) {
|
||||
if (data) {
|
||||
all_streams = data.streams;
|
||||
maybe_populate_subscriptions();
|
||||
}
|
||||
},
|
||||
error: function (xhr) {
|
||||
util.destroy_loading_indicator($('#subs_page_loading_indicator'));
|
||||
ui.report_error("Error listing subscriptions", xhr, $("#subscriptions-status"));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.subscribe_for_send = function (stream, prompt_button) {
|
||||
|
|
Loading…
Reference in New Issue