Remove "Create new stream" UI for restricted users.

If a user is not allowed to create new streams, then do not
show the "Create new stream" UI at the top of the settings page.

(imported from commit b97626938d8b612317c2189f7eca0d4bd27fc274)
This commit is contained in:
Steve Howell 2014-01-15 17:30:36 -05:00
parent 8bf9068d0b
commit ec91ece6ed
3 changed files with 8 additions and 1 deletions

View File

@ -420,7 +420,11 @@ exports.setup_page = function () {
});
$('#subscriptions_table').empty();
var rendered = templates.render('subscription_table_body', {subscriptions: sub_rows});
var template_data = {
can_create_streams: page_params.can_create_streams,
subscriptions: sub_rows
};
var rendered = templates.render('subscription_table_body', template_data);
$('#subscriptions_table').append(rendered);
_.each(sub_rows, function (row) {

View File

@ -1,3 +1,4 @@
{{#if can_create_streams}}
<div id="create_stream_row">
<div class="subscription_table_elem">
<form id="add_new_subscription" class="form-inline" action="">
@ -8,6 +9,7 @@
</form>
</div>
</div>
{{/if}}
{{#each subscriptions}}
{{partial "subscription"}}

View File

@ -852,6 +852,7 @@ def home(request):
muted_topics = register_ret['muted_topics'],
realm_filters = register_ret['realm_filters'],
is_admin = user_profile.is_admin(),
can_create_streams = user_profile.can_create_streams(),
notify_for_streams_by_default = notify_for_streams_by_default(user_profile),
name_changes_disabled = settings.NAME_CHANGES_DISABLED,
has_mobile_devices = num_push_devices_for_user(user_profile) > 0,