mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
streams: Add frontend to set/update message_retention_days of a stream.
This commit adds frontend support for setting and updating message retention days of a stream from stream settings. Message retention days can be changed from stream privacy modal of the stream and can be set from stream_creation_form while creating streams. Only admins can create streams with message_retention_days value other than realm_default. This commit also contains relevant changes to docs.
This commit is contained in:
@@ -169,6 +169,13 @@ function create_stream() {
|
||||
|
||||
data.stream_post_policy = JSON.stringify(stream_post_policy);
|
||||
|
||||
let message_retention_selection = $('#stream_creation_form select[name=stream_message_retention_setting]').val();
|
||||
if (message_retention_selection === "retain_for_period") {
|
||||
message_retention_selection = parseInt($('#stream_creation_form input[name=stream-message-retention-days]').val(), 10);
|
||||
}
|
||||
|
||||
data.message_retention_days = JSON.stringify(message_retention_selection);
|
||||
|
||||
const announce = stream_data.realm_has_notifications_stream() &&
|
||||
$('#announce-new-stream input').prop('checked');
|
||||
data.announce = JSON.stringify(announce);
|
||||
@@ -266,6 +273,8 @@ exports.show_new_stream_modal = function () {
|
||||
// Make the options default to the same each time:
|
||||
// public, "announce stream" on.
|
||||
$('#make-invite-only input:radio[value=public]').prop('checked', true);
|
||||
$("#stream_creation_form .stream-message-retention-days-input").hide();
|
||||
$("#stream_creation_form select[name=stream_message_retention_setting]").val("realm_default");
|
||||
|
||||
if (stream_data.realm_has_notifications_stream()) {
|
||||
$('#announce-new-stream').show();
|
||||
|
||||
Reference in New Issue
Block a user