zulip/web/src/group_permission_settings.ts

17 lines
573 B
TypeScript
Raw Normal View History

import {realm} from "./state_data";
import type {GroupPermissionSetting} from "./state_data";
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;
}