mirror of https://github.com/zulip/zulip.git
streams: Fix behavior of announce-stream checkbox in stream creation form.
This commit solves the bug which keeps the announce stream checkbox checked for non-admin users when users are only allowed to create private streams and not public streams. The desired behavior is to not allow users to announce private streams, so we keep the checkbox unchecked and disabled. This commit fixes the above mentioned bug by removing the if-else block which was executed after update_announce_stream_state (the function which handles updating the checkbox considering if the realm has notifications stream or not and whether the stream being created is public or private) and only checks whether the realm has notification stream or not to show or hide the announce stream checkbox irrespective of privacy of the stream being created. This commit also fixes the handler to update the checkbox state on changing privacy to update the checkbox state only on changing privacy value and not on toggling the checkbox itself or changing post policy. Fixes #21705.
This commit is contained in:
parent
02305e5927
commit
2b6d2df6ff
|
@ -310,13 +310,6 @@ export function show_new_stream_modal() {
|
|||
});
|
||||
|
||||
update_announce_stream_state();
|
||||
if (stream_data.realm_has_notifications_stream()) {
|
||||
$("#announce-new-stream").show();
|
||||
$("#announce-new-stream input").prop("disabled", false);
|
||||
$("#announce-new-stream input").prop("checked", true);
|
||||
} else {
|
||||
$("#announce-new-stream").hide();
|
||||
}
|
||||
clear_error_display();
|
||||
}
|
||||
|
||||
|
@ -326,7 +319,7 @@ export function set_up_handlers() {
|
|||
|
||||
const $container = $("#stream-creation").expectOne();
|
||||
|
||||
$container.on("change", "#make-invite-only input", update_announce_stream_state);
|
||||
$container.on("change", ".stream-privacy-values input", update_announce_stream_state);
|
||||
|
||||
$container.on("click", ".finalize_create_stream", (e) => {
|
||||
e.preventDefault();
|
||||
|
|
Loading…
Reference in New Issue