Merge pull request #6386 from overleaf/em-promisify

Promisify UserAdminController

GitOrigin-RevId: 51bf4ddd0673409006658fb0d8cc60a8b4e1071d
This commit is contained in:
Eric Mc Sween 2022-01-19 10:10:39 -05:00 committed by Copybot
parent 7446523205
commit fd60549482
4 changed files with 9 additions and 1 deletions

View file

@ -1,4 +1,4 @@
const { callbackify } = require('util') const { promisify, callbackify } = require('util')
const UserGetter = require('../User/UserGetter') const UserGetter = require('../User/UserGetter')
const UserMembershipsHandler = require('../UserMembership/UserMembershipsHandler') const UserMembershipsHandler = require('../UserMembership/UserMembershipsHandler')
const UserMembershipEntityConfigs = require('../UserMembership/UserMembershipEntityConfigs') const UserMembershipEntityConfigs = require('../UserMembership/UserMembershipEntityConfigs')
@ -80,6 +80,7 @@ const InstitutionsGetter = {
InstitutionsGetter.promises = { InstitutionsGetter.promises = {
getCurrentInstitutionIds, getCurrentInstitutionIds,
getCurrentInstitutionsWithLicence, getCurrentInstitutionsWithLicence,
getManagedInstitutions: promisify(InstitutionsGetter.getManagedInstitutions),
} }
module.exports = InstitutionsGetter module.exports = InstitutionsGetter

View file

@ -15,6 +15,7 @@
let PublishersGetter let PublishersGetter
const UserMembershipsHandler = require('../UserMembership/UserMembershipsHandler') const UserMembershipsHandler = require('../UserMembership/UserMembershipsHandler')
const UserMembershipEntityConfigs = require('../UserMembership/UserMembershipEntityConfigs') const UserMembershipEntityConfigs = require('../UserMembership/UserMembershipEntityConfigs')
const { promisifyAll } = require('../../util/promises')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const _ = require('underscore') const _ = require('underscore')
@ -30,3 +31,5 @@ module.exports = PublishersGetter = {
) )
}, },
} }
module.exports.promises = promisifyAll(PublishersGetter)

View file

@ -1,5 +1,6 @@
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const Metrics = require('@overleaf/metrics') const Metrics = require('@overleaf/metrics')
const { promisifyAll } = require('../../util/promises')
const LearnedWordsManager = require('./LearnedWordsManager') const LearnedWordsManager = require('./LearnedWordsManager')
module.exports = { module.exports = {
@ -24,3 +25,5 @@ module.exports = {
LearnedWordsManager.deleteUsersLearnedWords(userId, callback) LearnedWordsManager.deleteUsersLearnedWords(userId, callback)
}, },
} }
module.exports.promises = promisifyAll(module.exports)

View file

@ -399,6 +399,7 @@ const UserUpdater = {
const promises = { const promises = {
addAffiliationForNewUser: promisify(UserUpdater.addAffiliationForNewUser), addAffiliationForNewUser: promisify(UserUpdater.addAffiliationForNewUser),
addEmailAddress, addEmailAddress,
clearSAMLData,
confirmEmail, confirmEmail,
setDefaultEmailAddress, setDefaultEmailAddress,
updateUser: promisify(UserUpdater.updateUser), updateUser: promisify(UserUpdater.updateUser),