mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 20:31:34 +02:00
Merge pull request #13558 from overleaf/ab-group-sync-check-user-id-format
[web/cron] Check that the userId is a valid mongo ID GitOrigin-RevId: 0c5fce5c0e474ae9d8ad8683bccade2e0b74b0c7
This commit is contained in:
committed by
Copybot
parent
2ef48be496
commit
ded4de3349
@@ -7,6 +7,7 @@ const {
|
||||
} = require('../../app/src/models/DeletedSubscription')
|
||||
const minimist = require('minimist')
|
||||
const _ = require('lodash')
|
||||
const { ObjectId } = require('mongodb')
|
||||
|
||||
let FETCH_LIMIT, COMMIT, VERBOSE
|
||||
|
||||
@@ -195,6 +196,10 @@ async function checkDeletedSubscriptionMemberships(
|
||||
}
|
||||
|
||||
async function sendCorrectiveEvent(userId, event, subscription) {
|
||||
if (!ObjectId.isValid(userId)) {
|
||||
console.warn(`Skipping '${event}' for user ${userId}: invalid user ID`)
|
||||
return
|
||||
}
|
||||
const segmentation = {
|
||||
groupId: subscription._id.toString(),
|
||||
subscriptionId: subscription.recurlySubscription_id,
|
||||
|
||||
Reference in New Issue
Block a user