user-groups: Define max_user_group_name_length in user_groups.ts.

"max_user_group_name_length" is now defined in user_groups.ts
instead of user_group_edit.ts because we would use that value
in further commits in user_group_create.ts and importing it
from user_group_edit.ts would result in import cycle.
This commit is contained in:
Sahil Batra
2025-01-10 15:51:03 +05:30
committed by Tim Abbott
parent 126d76db50
commit 42fe2690e3
2 changed files with 7 additions and 7 deletions

View File

@@ -658,11 +658,6 @@ export function open_group_edit_panel_for_row(group_row: HTMLElement): void {
show_group_settings(group);
}
// Ideally this should be included in page params.
// Like we have realm.max_stream_name_length` and
// `realm.max_stream_description_length` for streams.
export const max_user_group_name_length = 100;
export function set_up_click_handlers(): void {
$("#groups_overlay").on("click", ".left #clear_search_group_name", (e) => {
const $input = $("#groups_overlay .left #search_group_name");
@@ -1042,7 +1037,7 @@ export function setup_page(callback: () => void): void {
upgrade_text_for_wide_organization_logo: realm.upgrade_text_for_wide_organization_logo,
is_business_type_org:
realm.realm_org_type === settings_config.all_org_type_values.business.code,
max_user_group_name_length,
max_user_group_name_length: user_groups.max_user_group_name_length,
};
const groups_overlay_html = render_user_group_settings_overlay(template_data);
@@ -1223,7 +1218,7 @@ export function initialize(): void {
const template_data = {
group_name: user_group.name,
group_description: user_group.description,
max_user_group_name_length,
max_user_group_name_length: user_groups.max_user_group_name_length,
};
const change_user_group_info_modal = render_change_user_group_info_modal(template_data);
dialog_widget.launch({

View File

@@ -41,6 +41,11 @@ export function init(): void {
// WE INITIALIZE DATA STRUCTURES HERE!
init();
// Ideally this should be included in page params.
// Like we have realm.max_stream_name_length` and
// `realm.max_stream_description_length` for streams.
export const max_user_group_name_length = 100;
export function add(user_group_raw: UserGroupRaw): UserGroup {
// Reformat the user group members structure to be a set.
const user_group = {