mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-06-28 02:11:30 +00:00
* feat: add terms acceptance timestamp tracking and migration script * feat: update migration script to use countUsers method for user count * Update config/migrate-terms-timestamp.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat: enhance terms acceptance response to include acceptance timestamp * fix: make terms acceptance idempotent and fail migration on partial errors Preserve the original termsAcceptedAt on repeat accepts within a terms cycle so retried or duplicate requests no longer overwrite the first acceptance time. Exit the migration script with a non-zero status when any per-user update fails so partial failures are not reported as successful. * style: fix import ordering in data-provider mutations * refactor: record terms acceptance atomically to preserve first-accept time Replace the read-then-write in acceptTermsController with a single atomic acceptTerms method that conditionally stamps termsAcceptedAt via an $ifNull aggregation update. This removes the TOCTOU window where two concurrent first-time accepts could overwrite the earlier acceptance timestamp, while still preserving an existing timestamp and backfilling legacy accepted users. * fix: run terms timestamp migration under system tenant context Wrap the count, cursor scan, and per-user updates in runAsSystem so the tenant isolation plugin does not throw under TENANT_ISOLATION_STRICT or scope the cross-tenant migration to a non-existent tenant, matching the other maintenance migrations. * fix: guard terms backfill against concurrent acceptances Add the missing-timestamp predicate to the per-user updateOne filter so a user who accepts through the API between the cursor read and the write keeps their real acceptance time instead of being overwritten with createdAt. Track modified vs skipped so the summary reflects skips. * fix: scope terms backfill to still-accepted users Add termsAccepted: true to the per-user updateOne filter so a reset that clears acceptance between the cursor read and the write is not re-stamped with createdAt, which would otherwise poison the next acceptance cycle through the $ifNull preserve in acceptTerms. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| translations | ||
| add-balance.js | ||
| ban-user.js | ||
| connect.js | ||
| create-user.js | ||
| delete-banner.js | ||
| delete-user.js | ||
| deployed-update.js | ||
| flush-cache.js | ||
| helpers.js | ||
| invite-user.js | ||
| jest.config.js | ||
| list-balances.js | ||
| list-users.js | ||
| migrate-agent-permissions.js | ||
| migrate-orphaned-agent-files.js | ||
| migrate-prompt-permissions.js | ||
| migrate-shared-link-permissions.js | ||
| migrate-terms-timestamp.js | ||
| packages.js | ||
| prepare.js | ||
| reset-meili-sync.js | ||
| reset-password.js | ||
| reset-terms.js | ||
| set-balance.js | ||
| smart-reinstall.js | ||
| stop-backend.js | ||
| test-subdirectory-setup.sh | ||
| update-banner.js | ||
| update.js | ||
| user-stats.js | ||