MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / userToFormValues

Function userToFormValues

frontend/src/utils/forms/UserUtils.js:32–63  ·  view source on GitHub ↗
(user)

Source from the content-addressed store, hash-verified

30};
31
32export const userToFormValues = (user) => {
33 const customProps = user.custom_properties || {};
34 const networks = customProps.allowed_networks || {};
35
36 return {
37 username: user.username,
38 first_name: user.first_name || '',
39 last_name: user.last_name || '',
40 email: user.email,
41 user_level: `${user.user_level}`,
42 stream_limit: user.stream_limit || 0,
43 channel_profiles:
44 user.channel_profiles.length > 0
45 ? user.channel_profiles.map((id) => `${id}`)
46 : ['0'],
47 xc_password: customProps.xc_password || '',
48 output_format: customProps.output_format || '',
49 output_profile: customProps.output_profile
50 ? `${customProps.output_profile}`
51 : '',
52 hide_adult_content: customProps.hide_adult_content || false,
53 epg_days: customProps.epg_days || 0,
54 epg_prev_days: customProps.epg_prev_days || 0,
55 allowed_ips: [
56 ...new Set(
57 NETWORK_KEYS.flatMap((key) =>
58 networks[key] ? networks[key].split(',').filter(Boolean) : []
59 )
60 ),
61 ],
62 };
63};
64
65export const formValuesToPayload = (values, existingUser) => {
66 const customProps = { ...(existingUser?.custom_properties || {}) };

Callers 2

UserFunction · 0.90
UserUtils.test.jsFile · 0.90

Calls 1

filterMethod · 0.45

Tested by

no test coverage detected