mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
15 lines
524 B
CoffeeScript
15 lines
524 B
CoffeeScript
|
UserGetter = require '../User/UserGetter'
|
||
|
logger = require 'logger-sharelatex'
|
||
|
|
||
|
module.exports = InstitutionsGetter =
|
||
|
getConfirmedInstitutions: (userId, callback = (error, institutions) ->) ->
|
||
|
UserGetter.getUserFullEmails userId, (error, emailsData) ->
|
||
|
return callback error if error?
|
||
|
|
||
|
confirmedInstitutions = emailsData.filter (emailData) ->
|
||
|
emailData.confirmedAt? and emailData.affiliation?.institution?
|
||
|
.map (emailData) ->
|
||
|
emailData.affiliation?.institution
|
||
|
|
||
|
callback(null, confirmedInstitutions)
|