mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 14:49:01 +02:00
[web] Remove promises exports from Controller modules (#22242)
* Remove promises object from CollaboratorsInviteController.mjs * Define functions at root * Remove mentions of undefined `revokeInviteForUser` * Remove unused `doLogout` * Remove promises object from UserController.js * Remove unused `makeChangePreview` * Remove promises object from SubscriptionController.js (`getRecommendedCurrency` and `getLatamCountryBannerDetails`) * Remove promises object from CollabratecController.mjs * Remove promises object from SSOController.mjs * Remove promises object from ReferencesApiController.mjs * Remove promises object from MetricsEmailController.mjs * Remove promises object from InstitutionHubsController.mjs * Remove promises object from DocumentUpdaterController.mjs * Remove promises object from SubscriptionAdminController.mjs * Fixup unit tests * Add expects that controllers don't error * Promisify `ensureAffiliationMiddleware` GitOrigin-RevId: 311c8afa7d5c8e4f051408d305b6b4147a020edc
This commit is contained in:
@@ -16,7 +16,7 @@ const HttpErrorHandler = require('../Errors/HttpErrorHandler')
|
||||
const OError = require('@overleaf/o-error')
|
||||
const EmailHandler = require('../Email/EmailHandler')
|
||||
const UrlHelper = require('../Helpers/UrlHelper')
|
||||
const { promisify, callbackify } = require('util')
|
||||
const { promisify } = require('util')
|
||||
const { expressify } = require('@overleaf/promise-utils')
|
||||
const {
|
||||
acceptsJson,
|
||||
@@ -212,11 +212,7 @@ async function ensureAffiliationMiddleware(req, res, next) {
|
||||
return next()
|
||||
}
|
||||
}
|
||||
try {
|
||||
await ensureAffiliation(user)
|
||||
} catch (error) {
|
||||
return next(error)
|
||||
}
|
||||
await ensureAffiliation(user)
|
||||
return next()
|
||||
}
|
||||
|
||||
@@ -505,13 +501,9 @@ module.exports = {
|
||||
subscribe: expressify(subscribe),
|
||||
unsubscribe: expressify(unsubscribe),
|
||||
updateUserSettings: expressify(updateUserSettings),
|
||||
doLogout: callbackify(doLogout),
|
||||
logout: expressify(logout),
|
||||
expireDeletedUser: expressify(expireDeletedUser),
|
||||
expireDeletedUsersAfterDuration: expressify(expireDeletedUsersAfterDuration),
|
||||
promises: {
|
||||
doLogout,
|
||||
ensureAffiliation,
|
||||
ensureAffiliationMiddleware,
|
||||
},
|
||||
ensureAffiliationMiddleware: expressify(ensureAffiliationMiddleware),
|
||||
ensureAffiliation,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user