mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 13:49:00 +02:00
Merge pull request #26764 from overleaf/rh-department-autocomplete
Use department institutions when adding email GitOrigin-RevId: d82df795428f8545f22a64b55986d2bf5fff0037
This commit is contained in:
@@ -32,6 +32,7 @@ export type DomainInfo = {
|
||||
name: string
|
||||
ssoEnabled?: boolean
|
||||
ssoBeta?: boolean
|
||||
departments?: string[]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -75,16 +75,21 @@ function InstitutionFields({
|
||||
}, [newEmailMatchedDomain, setRole, setDepartment])
|
||||
|
||||
useEffect(() => {
|
||||
if (newEmailMatchedDomain?.university?.departments?.length) {
|
||||
setDepartments(newEmailMatchedDomain.university.departments)
|
||||
return
|
||||
}
|
||||
|
||||
// fallback if not matched on domain
|
||||
const selectedKnownUniversity = countryCode
|
||||
? universities[countryCode]?.find(({ name }) => name === universityName)
|
||||
: undefined
|
||||
|
||||
if (selectedKnownUniversity && selectedKnownUniversity.departments.length) {
|
||||
setDepartments(selectedKnownUniversity.departments)
|
||||
} else {
|
||||
setDepartments([...defaultDepartments])
|
||||
}
|
||||
}, [countryCode, universities, universityName])
|
||||
}, [countryCode, universities, universityName, newEmailMatchedDomain])
|
||||
|
||||
// Fetch country institution
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user