mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #1876 from overleaf/spd-cleanup-stubs-no-user
Handle user stubs with no user in cleanup script GitOrigin-RevId: 810134f0876bc595f2d749921929b52dae4e7958
This commit is contained in:
committed by
sharelatex
parent
b46d855487
commit
4b0a445337
@@ -48,6 +48,14 @@ db.userstubs.aggregate(
|
||||
Number(argv.limit || '10'),
|
||||
(stub, callback) => {
|
||||
if (commit) {
|
||||
if (stub.users.length === 0) {
|
||||
console.log('Deleting stub without users:', stub._id)
|
||||
return db.userstubs.remove({ _id: stub._id }, callback)
|
||||
}
|
||||
if (stub.users.length > 1) {
|
||||
console.log('Found stub with multiple users:', stub)
|
||||
return callback()
|
||||
}
|
||||
console.log(
|
||||
'Processing stub',
|
||||
stub._id,
|
||||
@@ -61,6 +69,14 @@ db.userstubs.aggregate(
|
||||
callback
|
||||
)
|
||||
} else {
|
||||
if (stub.users.length === 0) {
|
||||
console.log('Would delete stub without users:', stub._id)
|
||||
return callback()
|
||||
}
|
||||
if (stub.users.length > 1) {
|
||||
console.log('Found stub with multiple users:', stub)
|
||||
return callback()
|
||||
}
|
||||
console.log(
|
||||
'Would call UserMapper._updateUserStubReferences with:',
|
||||
stub.overleaf,
|
||||
|
||||
Reference in New Issue
Block a user