From fd60549482542a4fc79cc877fad21a7ab6d29f5e Mon Sep 17 00:00:00 2001 From: Eric Mc Sween Date: Wed, 19 Jan 2022 10:10:39 -0500 Subject: [PATCH] Merge pull request #6386 from overleaf/em-promisify Promisify UserAdminController GitOrigin-RevId: 51bf4ddd0673409006658fb0d8cc60a8b4e1071d --- .../web/app/src/Features/Institutions/InstitutionsGetter.js | 3 ++- services/web/app/src/Features/Publishers/PublishersGetter.js | 3 +++ services/web/app/src/Features/Spelling/SpellingHandler.js | 3 +++ services/web/app/src/Features/User/UserUpdater.js | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/services/web/app/src/Features/Institutions/InstitutionsGetter.js b/services/web/app/src/Features/Institutions/InstitutionsGetter.js index c55fa716b5..495ee0a37f 100644 --- a/services/web/app/src/Features/Institutions/InstitutionsGetter.js +++ b/services/web/app/src/Features/Institutions/InstitutionsGetter.js @@ -1,4 +1,4 @@ -const { callbackify } = require('util') +const { promisify, callbackify } = require('util') const UserGetter = require('../User/UserGetter') const UserMembershipsHandler = require('../UserMembership/UserMembershipsHandler') const UserMembershipEntityConfigs = require('../UserMembership/UserMembershipEntityConfigs') @@ -80,6 +80,7 @@ const InstitutionsGetter = { InstitutionsGetter.promises = { getCurrentInstitutionIds, getCurrentInstitutionsWithLicence, + getManagedInstitutions: promisify(InstitutionsGetter.getManagedInstitutions), } module.exports = InstitutionsGetter diff --git a/services/web/app/src/Features/Publishers/PublishersGetter.js b/services/web/app/src/Features/Publishers/PublishersGetter.js index 0e44e4f4f7..95c4f83359 100644 --- a/services/web/app/src/Features/Publishers/PublishersGetter.js +++ b/services/web/app/src/Features/Publishers/PublishersGetter.js @@ -15,6 +15,7 @@ let PublishersGetter const UserMembershipsHandler = require('../UserMembership/UserMembershipsHandler') const UserMembershipEntityConfigs = require('../UserMembership/UserMembershipEntityConfigs') +const { promisifyAll } = require('../../util/promises') const logger = require('@overleaf/logger') const _ = require('underscore') @@ -30,3 +31,5 @@ module.exports = PublishersGetter = { ) }, } + +module.exports.promises = promisifyAll(PublishersGetter) diff --git a/services/web/app/src/Features/Spelling/SpellingHandler.js b/services/web/app/src/Features/Spelling/SpellingHandler.js index 9e3aa012a2..c913f970a0 100644 --- a/services/web/app/src/Features/Spelling/SpellingHandler.js +++ b/services/web/app/src/Features/Spelling/SpellingHandler.js @@ -1,5 +1,6 @@ const OError = require('@overleaf/o-error') const Metrics = require('@overleaf/metrics') +const { promisifyAll } = require('../../util/promises') const LearnedWordsManager = require('./LearnedWordsManager') module.exports = { @@ -24,3 +25,5 @@ module.exports = { LearnedWordsManager.deleteUsersLearnedWords(userId, callback) }, } + +module.exports.promises = promisifyAll(module.exports) diff --git a/services/web/app/src/Features/User/UserUpdater.js b/services/web/app/src/Features/User/UserUpdater.js index aad4f46b4e..7cf7fca75b 100644 --- a/services/web/app/src/Features/User/UserUpdater.js +++ b/services/web/app/src/Features/User/UserUpdater.js @@ -399,6 +399,7 @@ const UserUpdater = { const promises = { addAffiliationForNewUser: promisify(UserUpdater.addAffiliationForNewUser), addEmailAddress, + clearSAMLData, confirmEmail, setDefaultEmailAddress, updateUser: promisify(UserUpdater.updateUser),