Organization settings: "Default streams" tab view-only support.

This changes the layout of "organization settings" for
non-administrators such that they can view "Default streams" ("Actions"
and the form to add new default stream is not visible).
This commit is contained in:
Abhijeet Kaur
2017-04-15 02:38:22 +05:30
committed by Tim Abbott
parent f1e966bfaa
commit dc801eb5ed
6 changed files with 29 additions and 3 deletions

View File

@@ -122,13 +122,29 @@ function render(template_name, args) {
(function admin_default_streams_list() {
var html = '<table>';
var streams = ['devel', 'trac', 'zulip'];
// When the logged in user is admin
_.each(streams, function (stream) {
var args = {stream: {name: stream, invite_only: false}};
var args = {stream: {name: stream, invite_only: false},
can_modify: true,
};
html += render('admin_default_streams_list', args);
});
html += "</table>";
var span = $(html).find(".default_stream_name:first");
assert.equal(span.text(), "devel");
// When the logged in user is not admin
html = '<table>';
_.each(streams, function (stream) {
var args = {stream: {name: stream, invite_only: false},
can_modify: false,
};
html += render('admin_default_streams_list', args);
});
html += "</table>";
span = $(html).find(".default_stream_name:first");
assert.equal(span.text(), "devel");
global.write_handlebars_output("admin_default_streams_list", html);
}());