(raw)
| 2051 | } |
| 2052 | |
| 2053 | function normalizeUser(raw) { |
| 2054 | if (typeof raw === "string") { |
| 2055 | return { user_id: raw, label: raw, is_current: false, description: "", affiliation: "", has_profile: false, updated_at: "" }; |
| 2056 | } |
| 2057 | const userId = raw?.user_id || raw?.id || raw?.name || ""; |
| 2058 | const role = raw?.role_name ? `${raw.role_name} · ` : ""; |
| 2059 | const label = userId ? `${role}${userId}` : ui().common.untitledUser; |
| 2060 | return { |
| 2061 | user_id: userId || label, |
| 2062 | label, |
| 2063 | role_name: raw?.role_name || "", |
| 2064 | description: raw?.description || "", |
| 2065 | affiliation: raw?.affiliation || raw?.institution || raw?.organization || "", |
| 2066 | has_profile: Boolean(raw?.has_profile), |
| 2067 | updated_at: raw?.updated_at || "", |
| 2068 | is_current: Boolean(raw?.is_current) |
| 2069 | }; |
| 2070 | } |
| 2071 | |
| 2072 | async function loadUsers() { |
| 2073 | const data = await api("/api/users"); |
no test coverage detected