Skip to content

🚮 feat: Enhance "Delete User" Script #7899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 15, 2025

Conversation

rubentalstra
Copy link
Collaborator

Summary

This pull request significantly enhances the delete-user.js script to delete not only a user but also all associated data across multiple collections in the database. It introduces a more comprehensive deletion process, user confirmation prompts, and optional transaction history deletion.

Enhancements to user deletion functionality:

  • Expanded the deletion scope to include all associated data across multiple collections (Agent, Assistant, Balance, Transaction, ConversationTag, Conversation, Message, File, Key, MemoryEntry, PluginAuth, Prompt, PromptGroup, Preset, Session, SharedLink, ToolCall, and Token) when deleting a user.
  • Added a confirmation prompt for deleting all user data, including a separate prompt for transaction history deletion.

Code improvements:

  • Simplified the email input process by directly reading from process.argv[2] or prompting the user if not provided.
  • Improved error handling and user feedback messages for better clarity during the deletion process.

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Testing

Screenshot 2025-06-14 at 14 25 42

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules.

@rubentalstra rubentalstra self-assigned this Jun 14, 2025
@rubentalstra rubentalstra added the 🔧 fix Bug fixes and code patches label Jun 14, 2025
@rubentalstra rubentalstra linked an issue Jun 14, 2025 that may be closed by this pull request
1 task
@rubentalstra rubentalstra changed the base branch from main to dev June 14, 2025 12:26
@rubentalstra rubentalstra requested a review from Copilot June 14, 2025 12:26
Copilot

This comment was marked as outdated.

@rubentalstra rubentalstra requested a review from Copilot June 14, 2025 12:33
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the delete-user.js script to fully remove a user and all their related data with interactive confirmations and cleaner shutdown.

  • Expanded deletion scope across 20+ collections linked to a user.
  • Added two-step confirmation prompts (full data and transaction history).
  • Introduced gracefulExit for clean MongoDB disconnection and improved error handling.
Comments suppressed due to low confidence (1)

config/delete-user.js:38

  • Add automated tests (unit or integration) for this main IIFE to verify both full and partial deletion flows, plus the gracefulExit behavior.
(async () => {

is a good idea

Co-authored-by: Copilot <[email protected]>
@rubentalstra rubentalstra requested a review from danny-avila June 14, 2025 12:37
@rubentalstra rubentalstra added this to the v0.7.9 milestone Jun 14, 2025
@danny-avila danny-avila changed the title fix: deep delete user script 🚮 feat: Enhance "Delete User" Script Jun 15, 2025
@danny-avila danny-avila merged commit b412455 into dev Jun 15, 2025
@danny-avila danny-avila deleted the 7898-fix-delete-user-script-allow-deep-delete branch June 15, 2025 19:08
jmaddington pushed a commit to jmaddington/LibreChat that referenced this pull request Jun 21, 2025
* 🔧 fix: Enhance user deletion script to allow deep deletion of related data

* 🔧 fix: Update user deletion script to confirm deep deletion of transaction history

* 🔧 fix: Refactor user deletion script to use graceful exit and ensure deep deletion of related data

* Update config/delete-user.js

is a good idea

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
rhonyabdullah pushed a commit to rhonyabdullah/LibreChat that referenced this pull request Jun 27, 2025
* 🔧 fix: Enhance user deletion script to allow deep deletion of related data

* 🔧 fix: Update user deletion script to confirm deep deletion of transaction history

* 🔧 fix: Refactor user deletion script to use graceful exit and ensure deep deletion of related data

* Update config/delete-user.js

is a good idea

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
kenshinsamue pushed a commit to intelequia/LibreChat that referenced this pull request Aug 4, 2025
* 🔧 fix: Enhance user deletion script to allow deep deletion of related data

* 🔧 fix: Update user deletion script to confirm deep deletion of transaction history

* 🔧 fix: Refactor user deletion script to use graceful exit and ensure deep deletion of related data

* Update config/delete-user.js

is a good idea

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔧 fix Bug fixes and code patches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FIX]: delete-user script: Allow deep delete
2 participants