streams: Make stream settings and create stream UI more consistent.

This commit make changes in create stream panel by moving
announce stream option below stream description and adds a
"Stream permissions" section heading just above
"Who can access the stream?" and also rewords the text
"Announce stream".

Also now announce stream option is only shown if the user creating
stream have access to the announcement stream name. When option
is not shown, default behaviour is to announce public and
web-public streams.

Fixes #23327.
This commit is contained in:
Ujjawal Modi
2023-03-22 21:20:49 +05:30
committed by Tim Abbott
parent 308f42eded
commit 449febf036
9 changed files with 60 additions and 20 deletions

View File

@@ -123,7 +123,7 @@ let stream_announce_previous_value =
// Within the new stream modal...
function update_announce_stream_state() {
// If there is no notifications_stream, we simply hide the widget.
if (!stream_data.realm_has_notifications_stream()) {
if (stream_data.get_notifications_stream() === "") {
$("#announce-new-stream").hide();
return;
}
@@ -235,9 +235,18 @@ function create_stream() {
data.message_retention_days = JSON.stringify(message_retention_selection);
const announce =
stream_data.realm_has_notifications_stream() &&
let announce =
stream_data.get_notifications_stream() !== "" &&
$("#announce-new-stream input").prop("checked");
if (
stream_data.get_notifications_stream() === "" &&
stream_data.realm_has_notifications_stream() &&
!invite_only
) {
announce = true;
}
data.announce = JSON.stringify(announce);
// TODO: We can eliminate the user_ids -> principals conversion