Merge pull request #16294 from overleaf/em-premium-routes-super-props

Add super properties to support premium routes determination on events

GitOrigin-RevId: d85733f25b7bf12ca59591fece8f3cbd604be04f
This commit is contained in:
Eric Mc Sween 2024-01-04 08:28:33 -05:00 committed by Copybot
parent 6948d23adb
commit ad53583e3a

View file

@ -3,7 +3,7 @@ const UserGetter = require('../User/UserGetter')
const UserMembershipsHandler = require('../UserMembership/UserMembershipsHandler')
const UserMembershipEntityConfigs = require('../UserMembership/UserMembershipEntityConfigs')
async function _getCurrentAffiliations(userId) {
async function getCurrentAffiliations(userId) {
const fullEmails = await UserGetter.promises.getUserFullEmails(userId)
// current are those confirmed and not with lapsed reconfirmations
return fullEmails
@ -22,7 +22,7 @@ async function getCurrentInstitutionIds(userId) {
// current are those confirmed and not with lapsed reconfirmations
// only 1 record returned per current institutionId
const institutionIds = new Set()
const currentAffiliations = await _getCurrentAffiliations(userId)
const currentAffiliations = await getCurrentAffiliations(userId)
currentAffiliations.forEach(affiliation => {
institutionIds.add(affiliation.institution.id)
})
@ -33,7 +33,7 @@ async function getCurrentInstitutionsWithLicence(userId) {
// current are those confirmed and not with lapsed reconfirmations
// only 1 record returned per current institution
const institutions = {}
const currentAffiliations = await _getCurrentAffiliations(userId)
const currentAffiliations = await getCurrentAffiliations(userId)
currentAffiliations.forEach(affiliation => {
if (affiliation.licence && affiliation.licence !== 'free') {
institutions[affiliation.institution.id] = affiliation.institution
@ -78,6 +78,7 @@ const InstitutionsGetter = {
}
InstitutionsGetter.promises = {
getCurrentAffiliations,
getCurrentInstitutionIds,
getCurrentInstitutionsWithLicence,
getManagedInstitutions: promisify(InstitutionsGetter.getManagedInstitutions),