[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:
Antoine Clausse
2025-01-17 09:06:05 +01:00
committed by Copybot
parent ae34c4b8cc
commit b9fb636f0b
9 changed files with 487 additions and 540 deletions

View File

@@ -916,7 +916,7 @@ describe('UserController', function () {
describe('ensureAffiliationMiddleware', function () {
describe('without affiliations feature', function () {
beforeEach(async function () {
await this.UserController.promises.ensureAffiliationMiddleware(
await this.UserController.ensureAffiliationMiddleware(
this.req,
this.res,
this.next
@@ -938,7 +938,7 @@ describe('UserController', function () {
describe('without ensureAffiliation query parameter', function () {
beforeEach(async function () {
this.Features.hasFeature.withArgs('affiliations').returns(true)
await this.UserController.promises.ensureAffiliationMiddleware(
await this.UserController.ensureAffiliationMiddleware(
this.req,
this.res,
this.next
@@ -968,7 +968,7 @@ describe('UserController', function () {
]
this.Features.hasFeature.withArgs('affiliations').returns(true)
this.req.query.ensureAffiliation = true
await this.UserController.promises.ensureAffiliationMiddleware(
await this.UserController.ensureAffiliationMiddleware(
this.req,
this.res,
this.next
@@ -1005,7 +1005,7 @@ describe('UserController', function () {
this.Features.hasFeature.withArgs('affiliations').returns(true)
this.req.query.ensureAffiliation = true
this.req.assertPermission = sinon.stub()
await this.UserController.promises.ensureAffiliationMiddleware(
await this.UserController.ensureAffiliationMiddleware(
this.req,
this.res,
this.next
@@ -1047,7 +1047,7 @@ describe('UserController', function () {
this.Features.hasFeature.withArgs('affiliations').returns(true)
this.req.query.ensureAffiliation = true
this.req.assertPermission = sinon.stub()
await this.UserController.promises.ensureAffiliationMiddleware(
await this.UserController.ensureAffiliationMiddleware(
this.req,
this.res,
this.next
@@ -1089,7 +1089,7 @@ describe('UserController', function () {
this.Features.hasFeature.withArgs('affiliations').returns(true)
this.req.query.ensureAffiliation = true
this.req.assertPermission = sinon.stub()
await this.UserController.promises.ensureAffiliationMiddleware(
await this.UserController.ensureAffiliationMiddleware(
this.req,
this.res,
this.next