MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / normalizeUser

Function normalizeUser

deployments/desktop/static/desktop.js:2053–2070  ·  view source on GitHub ↗
(raw)

Source from the content-addressed store, hash-verified

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");

Callers 3

loadUsersFunction · 0.85
selectedUserInfoFunction · 0.85
saveProfileFunction · 0.85

Calls 1

uiFunction · 0.85

Tested by

no test coverage detected