[web] Rename team name IEEECollabratec to IEEEPublications (#18387)

* Replaces all `IEEECollabratec` by `IEEEPublications`

* Revert change in migration

GitOrigin-RevId: f0445b726abdc5f65b7a0613d9979b081332685e
This commit is contained in:
Antoine Clausse 2024-05-16 18:07:54 +02:00 committed by Copybot
parent f652c49713
commit d7f0c66d86
2 changed files with 15 additions and 15 deletions

View file

@ -8,7 +8,7 @@ const { db } = require('../app/src/infrastructure/mongodb')
const { promiseMapWithLimit } = require('@overleaf/promise-utils') const { promiseMapWithLimit } = require('@overleaf/promise-utils')
/** /**
* This script is used to notify some users in the IEEECollabratec group that * This script is used to notify some users in the IEEEPublications group that
* they will lose access to Overleaf. * they will lose access to Overleaf.
* *
* Parameters: * Parameters:
@ -43,7 +43,7 @@ function getActiveUserEmails(filename) {
async function getIEEEUsers() { async function getIEEEUsers() {
return await db.subscriptions return await db.subscriptions
.aggregate([ .aggregate([
{ $match: { teamName: 'IEEECollabratec' } }, { $match: { teamName: 'IEEEPublications' } },
{ $unwind: '$member_ids' }, { $unwind: '$member_ids' },
{ {
$lookup: { $lookup: {
@ -75,11 +75,11 @@ async function main() {
await waitForDb() await waitForDb()
const subscription = await Subscription.findOne({ const subscription = await Subscription.findOne({
teamName: 'IEEECollabratec', teamName: 'IEEEPublications',
}) })
if (!subscription) { if (!subscription) {
console.error(`No IEEECollabratec group subscription found so quitting`) console.error(`No IEEEPublications group subscription found so quitting`)
return return
} }
@ -125,10 +125,10 @@ async function main() {
totalUsersNotified += 1 totalUsersNotified += 1
}) })
console.log(`Found ${totalUsers} users in IEEECollabratec group`) console.log(`Found ${totalUsers} users in IEEEPublications group`)
console.log( console.log(
`Found ${totalUsersNotified} users in IEEECollabratec group to notify` `Found ${totalUsersNotified} users in IEEEPublications group to notify`
) )
console.log(`Found ${activeUsersFound.size} active users`) console.log(`Found ${activeUsersFound.size} active users`)

View file

@ -9,7 +9,7 @@ const { promiseMapWithLimit } = require('@overleaf/promise-utils')
const _ = require('lodash') const _ = require('lodash')
/** /**
* This script is used to remove some users from the IEEECollabratec group. * This script is used to remove some users from the IEEEPublications group.
* *
* Parameters: * Parameters:
* --filename: the filename of the JSON file containing emails of users that * --filename: the filename of the JSON file containing emails of users that
@ -43,7 +43,7 @@ function getActiveUserEmails(filename) {
async function getIEEEUsers() { async function getIEEEUsers() {
const results = await db.subscriptions const results = await db.subscriptions
.aggregate([ .aggregate([
{ $match: { teamName: 'IEEECollabratec' } }, { $match: { teamName: 'IEEEPublications' } },
{ $unwind: '$member_ids' }, { $unwind: '$member_ids' },
{ {
$lookup: { $lookup: {
@ -79,11 +79,11 @@ async function main() {
await waitForDb() await waitForDb()
const subscription = await Subscription.findOne({ const subscription = await Subscription.findOne({
teamName: 'IEEECollabratec', teamName: 'IEEEPublications',
}) })
if (!subscription) { if (!subscription) {
console.error(`No IEEECollabratec group subscription found so quitting`) console.error(`No IEEEPublications group subscription found so quitting`)
return return
} }
@ -93,12 +93,12 @@ async function main() {
const oldMemberIds = subscription.member_ids.map(id => id.toString()) const oldMemberIds = subscription.member_ids.map(id => id.toString())
console.log( console.log(
`Found ${oldMemberIds.length} members_ids in IEEECollabratec group` `Found ${oldMemberIds.length} members_ids in IEEEPublications group`
) )
const usersArray = await getIEEEUsers() const usersArray = await getIEEEUsers()
console.log( console.log(
`Found ${usersArray.length} users in IEEECollabratec group. (${oldMemberIds.length - usersArray.length} missing)` `Found ${usersArray.length} users in IEEEPublications group. (${oldMemberIds.length - usersArray.length} missing)`
) )
const activeUsers = getActiveUserEmails(EMAILS_FILENAME) const activeUsers = getActiveUserEmails(EMAILS_FILENAME)
@ -150,7 +150,7 @@ async function main() {
if (COMMIT) { if (COMMIT) {
await Subscription.updateOne( await Subscription.updateOne(
{ teamName: 'IEEECollabratec' }, { teamName: 'IEEEPublications' },
{ member_ids: memberIdsToKeep } { member_ids: memberIdsToKeep }
) )
} }
@ -165,10 +165,10 @@ async function main() {
console.log(activeUsersNotFound) console.log(activeUsersNotFound)
const subscriptionAfter = await Subscription.findOne({ const subscriptionAfter = await Subscription.findOne({
teamName: 'IEEECollabratec', teamName: 'IEEEPublications',
}) })
console.log( console.log(
`There are now ${subscriptionAfter?.member_ids?.length} members_ids in IEEECollabratec group` `There are now ${subscriptionAfter?.member_ids?.length} members_ids in IEEEPublications group`
) )
const end = performance.now() const end = performance.now()