org settings: Remove "Delete streams" administrative tab from settings.

Fixes #9227
This commit is contained in:
Yashashvi Dave 2018-04-30 16:52:38 +05:30
parent 0a7d1bc746
commit 7bbe44d7a0
10 changed files with 11 additions and 108 deletions

View File

@ -329,8 +329,7 @@ function render(template_name, args) {
};
var html = render('admin_tab', args);
var admin_features = ["admin_users_table", "admin_bots_table",
"admin_streams_table", "admin_deactivated_users_table",
"admin_invites_table"];
"admin_deactivated_users_table", "admin_invites_table"];
_.each(admin_features, function (admin_feature) {
assert.notEqual($(html).find("#" + admin_feature).length, 0);
});

View File

@ -22,7 +22,6 @@ exports.load_admin_section = function (name) {
case 'deactivated-users-admin':
section = 'users';
break;
case 'streams-list-admin':
case 'default-streams-list':
section = 'streams';
break;

View File

@ -109,7 +109,6 @@ function _setup_page() {
"user-list-admin": i18n.t("Active users"),
"deactivated-users-admin": i18n.t("Deactivated users"),
"bot-list-admin": i18n.t("Bot list"),
"streams-list-admin": i18n.t("Streams"),
"default-streams-list": i18n.t("Default streams"),
"filter-settings": i18n.t("Filter settings"),
"invites-list-admin": i18n.t("Invitations"),

View File

@ -10,32 +10,6 @@ exports.reset = function () {
meta.loaded = false;
};
function populate_streams() {
var streams_table = $("#admin_streams_table").expectOne();
var items = stream_data.get_streams_for_admin();
list_render(streams_table, items, {
name: "admin_streams_list",
modifier: function (item) {
return templates.render("admin_streams_list", { stream: item });
},
filter: {
element: streams_table.closest(".settings-section").find(".search"),
callback: function (item, value) {
return item.name.toLowerCase().indexOf(value) >= 0;
},
onupdate: function () {
ui.update_scrollbar(streams_table.closest(".progressive-table-wrapper"));
},
},
}).init();
ui.set_up_scrollbar(streams_table.closest(".progressive-table-wrapper"));
loading.destroy_indicator($('#admin_page_streams_loading_indicator'));
}
exports.build_default_stream_table = function (streams_data) {
var self = {};
@ -116,25 +90,8 @@ function make_stream_default(stream_name) {
exports.set_up = function () {
meta.loaded = true;
populate_streams();
exports.update_default_streams_table();
$(".admin_stream_table").on("click", ".deactivate", function (e) {
e.preventDefault();
e.stopPropagation();
$(".active_stream_row").removeClass("active_stream_row");
var row = $(e.target).closest(".stream_row");
row.addClass("active_stream_row");
var stream_name = row.find('.stream_name').text();
var deactivate_stream_modal = templates.render('deactivation-stream-modal', {stream_name: stream_name});
$("#settings_content .organization-box").append(deactivate_stream_modal);
overlays.open_modal('deactivation_stream_modal');
});
$('.create_default_stream').keypress(function (e) {
if (e.which === 13) {
e.preventDefault();
@ -182,10 +139,6 @@ exports.set_up = function () {
},
});
});
$("#settings_content").on("hide.bs.modal", "#deactivation_stream_modal", function () {
$("#deactivation_stream_modal").remove();
});
};
exports.delete_stream = function (stream_id, alert_element, stream_row) {
@ -200,23 +153,6 @@ exports.delete_stream = function (stream_id, alert_element, stream_row) {
});
};
$(function () {
$("#settings_overlay_container").on("click", "#do_deactivate_stream_button", function () {
if ($("#deactivation_stream_modal .stream_name").text() !== $(".active_stream_row").find('.stream_name').text()) {
blueslip.error("Stream deactivation canceled due to non-matching fields.");
ui_report.message(i18n.t("Deactivation encountered an error. Please reload and try again."),
$("#home-error"), 'alert-error');
}
overlays.close_modal('deactivation_stream_modal');
$("#deactivation_stream_modal").remove();
$(".active_stream_row button").prop("disabled", true).text(i18n.t("Working…"));
var stream_name = $(".active_stream_row").find('.stream_name').text();
var stream_id = stream_data.get_sub(stream_name).stream_id;
var row = $(".active_stream_row");
exports.delete_stream(stream_id, $("#organization-status"), row);
});
});
return exports;
}());

View File

@ -2043,8 +2043,7 @@ div.floating_recipient {
.settings-section #admin_page_users_loading_indicator,
.settings-section #admin_page_deactivated_users_loading_indicator,
.settings-section #admin_page_bots_loading_indicator,
.settings-section #admin_page_streams_loading_indicator {
.settings-section #admin_page_bots_loading_indicator {
margin: 0 auto;
}

View File

@ -17,8 +17,6 @@
{{ partial "bot-list-admin" }}
{{ partial "streams-list-admin" }}
{{ partial "default-streams-list-admin" }}
{{ partial "auth-methods-settings-admin" }}

View File

@ -1,20 +0,0 @@
<div id="admin-streams-list" class="settings-section" data-name="streams-list-admin">
<div class="tip">
{{#tr this}}Most stream administration is done on the <a href="/#streams">Streams page</a>.{{/tr}}
</div>
<input type="text" class="search" placeholder="{{t 'Filter streams' }}" aria-label="{{t 'Filter streams' }}"/>
<div class="clear-float"></div>
<div class="progressive-table-wrapper">
<table class="table table-condensed table-striped">
<thead>
<th>{{t "Name" }}</th>
<th class="actions">{{t "Actions" }}</th>
</thead>
<tbody id="admin_streams_table" class="admin_stream_table required-text"
data-empty="{{t 'No streams match your current filter.' }}"></tbody>
</table>
</div>
<div id="admin_page_streams_loading_indicator"></div>
</div>

View File

@ -78,12 +78,6 @@
<i class="icon icon-vector-github"></i>
<div class="text">{{ _('Bots') }}</div>
</li>
{% if is_admin %}
<li class="admin" tabindex="0" data-section="streams-list-admin">
<i class="icon icon-vector-exchange"></i>
<div class="text">{{ _('Delete streams') }}</div>
</li>
{% endif %}
<li class="admin" tabindex="0" data-section="default-streams-list">
<i class="icon icon-vector-exchange"></i>
<div class="text">{{ _('Default streams') }}</div>

View File

@ -2,17 +2,18 @@
{!admin-only.md!}
In Zulip, most stream administration is done on the subscription page.
However, Zulip organization administrators must use the Zulip
**[organization administration interface](/help/change-your-organization-settings)**
to delete streams.
{!subscriptions.md!}
{!filter-streams.md!}
{settings_tab|streams-list-admin}
!!! tip ""
{!all-streams.md!}
2. Find the stream you want to delete, and click the **Delete stream** button to
the right of it.
2. Click on the stream that you want to delete; {!stream-settings.md!}
3. Upon clicking on the **Delete stream** button, a confirmation window titled
3. Click the **Delete** button to
the right of the **Streams Settings** section.
4. Upon clicking on the **Delete** button, a confirmation window titled
**Delete stream (stream name)** will appear. Click the **Yes, delete this stream**
button to delete the stream.

View File

@ -35,8 +35,6 @@ link_mapping = {
'deactivated-users-admin': ['Manage organization', 'Deactivated users',
'/#organization/deactivated-users-admin'],
'bot-list-admin': ['Manage organization', 'Bots', '/#organization/bot-list-admin'],
'streams-list-admin': ['Manage organization', 'Delete streams',
'/#organization/streams-list-admin'],
'default-streams-list': ['Manage organization', 'Default streams',
'/#organization/default-streams-list'],
'filter-settings': ['Manage organization', 'Filter settings',