zulip/web/src/group_permission_settings.ts

17 lines
579 B
TypeScript

import {realm} from "./state_data.ts";
import type {GroupPermissionSetting} from "./state_data.ts";
export function get_group_permission_setting_config(
setting_name: string,
setting_type: "realm" | "stream" | "group",
): GroupPermissionSetting | undefined {
const permission_settings_dict = realm.server_supported_permission_settings;
const permission_config_dict = permission_settings_dict[setting_type][setting_name];
if (!permission_config_dict) {
throw new Error(`Invalid setting: ${setting_name}`);
}
return permission_config_dict;
}