From 75a602ec29f831fe6d248e4111de868c71416aa2 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Wed, 18 Aug 2021 16:56:07 +0200 Subject: [PATCH] Merge pull request #4813 from overleaf/jpa-debug-non-pro [web] check_institution_users: add option for debugging non pro users GitOrigin-RevId: 11743e10a8be567028611d7e109c0450b08e11fc --- .../web/app/src/Features/Institutions/InstitutionsManager.js | 5 ++++- services/web/scripts/check_institution_users.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/services/web/app/src/Features/Institutions/InstitutionsManager.js b/services/web/app/src/Features/Institutions/InstitutionsManager.js index 4f7b77e645..dba36b7ac8 100644 --- a/services/web/app/src/Features/Institutions/InstitutionsManager.js +++ b/services/web/app/src/Features/Institutions/InstitutionsManager.js @@ -70,7 +70,7 @@ async function _checkUsersFeatures(userIds) { return result } -async function checkInstitutionUsers(institutionId) { +async function checkInstitutionUsers(institutionId, emitNonProUserIds) { /* v1 has affiliation data. Via getInstitutionAffiliationsCounts, v1 will send lapsed_user_ids, which includes all user types @@ -178,6 +178,9 @@ async function checkInstitutionUsers(institutionId) { result.emailUsers.nonPro[userType]++ } }) + if (emitNonProUserIds) { + result.nonProUserIds = nonProUserIds + } return result } diff --git a/services/web/scripts/check_institution_users.js b/services/web/scripts/check_institution_users.js index fe808c4667..56d9b21386 100644 --- a/services/web/scripts/check_institution_users.js +++ b/services/web/scripts/check_institution_users.js @@ -4,6 +4,7 @@ const InstitutionsManager = require('../app/src/Features/Institutions/Institutio const institutionId = parseInt(process.argv[2]) if (isNaN(institutionId)) throw new Error('No institution id') console.log('Checking users of institution', institutionId) +const emitNonProUserIds = process.argv.includes('--emit-non-pro-user-ids') waitForDb() .then(main) @@ -14,7 +15,8 @@ waitForDb() async function main() { const usersSummary = await InstitutionsManager.promises.checkInstitutionUsers( - institutionId + institutionId, + emitNonProUserIds ) console.log(usersSummary) process.exit()