Fix the Admin page not working for newly-knighted users.

Previously, while you'd get the event saying you'd been knighted,
which would make the Administration tab visible, clicking on the tab
would error out because the admin page HTML was never sent over on
page load (since you weren't an admin at that point).

(imported from commit 90ad351533515bebece630d67baf4b142d320754)
This commit is contained in:
Jessica McKellar 2014-01-27 15:48:23 -05:00
parent ac3f93d760
commit 7085dca1ce
4 changed files with 14 additions and 5 deletions

View File

@ -71,6 +71,10 @@ function populate_streams (streams_data) {
} }
exports.setup_page = function () { exports.setup_page = function () {
var admin_tab = templates.render('admin_tab');
$("#administration").html(admin_tab);
$("#administration-status").hide();
// create loading indicators // create loading indicators
util.make_loading_indicator($('#admin_page_users_loading_indicator')); util.make_loading_indicator($('#admin_page_users_loading_indicator'));
util.make_loading_indicator($('#admin_page_bots_loading_indicator')); util.make_loading_indicator($('#admin_page_bots_loading_indicator'));

View File

@ -1,8 +1,6 @@
{# Administration panel #}
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span12">
<div class="administration"> <div class="administration">
<div class="alert" id="administration-status"></div> <div class="alert" id="administration-status"></div>
<h1>Administration</h1> <h1>Administration</h1>
<h2>Users</h2> <h2>Users</h2>
@ -71,4 +69,3 @@
</div> </div>
</div> </div>
</div> </div>

View File

@ -72,7 +72,6 @@ var page_params = {{ page_params }};
{% include "zerver/subscriptions.html" %} {% include "zerver/subscriptions.html" %}
</div> </div>
<div class="tab-pane" id="administration"> <div class="tab-pane" id="administration">
{% include "zerver/administration.html" %}
</div> </div>
<div class="tab-pane" id="settings"> <div class="tab-pane" id="settings">
{% include "zerver/settings.html" %} {% include "zerver/settings.html" %}

View File

@ -66,6 +66,15 @@ function render(template_name, args) {
global.write_test_output("actions_popover_content.handlebars", html); global.write_test_output("actions_popover_content.handlebars", html);
}()); }());
(function admin_tab() {
var html = render('admin_tab');
var admin_features = ["admin_users_table", "admin_bots_table",
"admin_streams_table", "admin_deactivated_users_table"];
_.each(admin_features, function (admin_feature) {
assert.notEqual($(html).find("#" + admin_feature).length, 0);
});
}());
(function admin_streams_list() { (function admin_streams_list() {
var html = '<table>'; var html = '<table>';
var streams = ['devel', 'trac', 'zulip']; var streams = ['devel', 'trac', 'zulip'];