mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 03:33:27 +00:00
Move default email checking logic into the data service.
This commit is contained in:
parent
47c51257bb
commit
042c959d3a
2 changed files with 7 additions and 3 deletions
|
@ -25,9 +25,8 @@ define [
|
|||
resolve:
|
||||
userDefaultEmail: () ->
|
||||
UserAffiliationsDataService
|
||||
.getUserEmails()
|
||||
.then (userEmails) ->
|
||||
defaultEmailDetails = _.find userEmails, (userEmail) -> userEmail.default
|
||||
.getUserDefaultEmail()
|
||||
.then (defaultEmailDetails) ->
|
||||
return defaultEmailDetails?.email or null
|
||||
.catch () -> null
|
||||
)
|
||||
|
|
|
@ -31,6 +31,10 @@ define [
|
|||
$http.get "/user/emails"
|
||||
.then (response) -> response.data
|
||||
|
||||
getUserDefaultEmail = () ->
|
||||
getUserEmails().then (userEmails) ->
|
||||
_.find userEmails, (userEmail) -> userEmail.default
|
||||
|
||||
getUniversitiesFromCountry = (country) ->
|
||||
if universities[country.code]?
|
||||
universitiesFromCountry = universities[country.code]
|
||||
|
@ -118,6 +122,7 @@ define [
|
|||
getDefaultRoleHints
|
||||
getDefaultDepartmentHints
|
||||
getUserEmails
|
||||
getUserDefaultEmail
|
||||
getUniversitiesFromCountry
|
||||
getUniversityDomainFromPartialDomainInput
|
||||
getUniversityDetails
|
||||
|
|
Loading…
Reference in a new issue