streams: Show error when trying to make a default stream private.

We show failure message in stream privacy modal when user tries to
set a default stream as private.
This commit is contained in:
sahil839 2020-08-09 01:46:22 +05:30 committed by Tim Abbott
parent 1477416515
commit 8d783e9d46
2 changed files with 5 additions and 1 deletions

View File

@ -495,6 +495,8 @@ function change_stream_privacy(e) {
const stream_id = $(e.target).data("stream-id"); const stream_id = $(e.target).data("stream-id");
const sub = stream_data.get_sub_by_id(stream_id); const sub = stream_data.get_sub_by_id(stream_id);
const data = {}; const data = {};
const stream_privacy_status = $(".stream-privacy-status");
stream_privacy_status.hide();
const privacy_setting = $("#stream_privacy_modal input[name=privacy]:checked").val(); const privacy_setting = $("#stream_privacy_modal input[name=privacy]:checked").val();
const stream_post_policy = Number.parseInt( const stream_post_policy = Number.parseInt(
@ -560,7 +562,8 @@ function change_stream_privacy(e) {
$("#stream_privacy_modal").remove(); $("#stream_privacy_modal").remove();
// The rest will be done by update stream event we will get. // The rest will be done by update stream event we will get.
}, },
error() { error(xhr) {
ui_report.error(i18n.t("Failed"), xhr, stream_privacy_status);
$("#change-stream-privacy-button").text(i18n.t("Try again")); $("#change-stream-privacy-button").text(i18n.t("Try again"));
}, },
}); });

View File

@ -1,4 +1,5 @@
<ul class="grey-box"> <ul class="grey-box">
<div class="alert stream-privacy-status"></div>
<h4>{{t 'Who can access the stream?'}} <h4>{{t 'Who can access the stream?'}}
{{> help_link_widget link="/help/stream-permissions" }} {{> help_link_widget link="/help/stream-permissions" }}
</h4> </h4>