RocketChat / RocketChat/Rocket.Chat
[bug] Message Erasure Type `Keep Messages And User Name` not work as expected
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
In Admin UI - Message we have Message Erasure Type option.
Default is Delete All Messages
But if you set Keep Messages And User Name - you get same behavior and Delete All Messages set - all users messages are deleted.
Steps to reproduce:
- Set
Keep Messages And User Namevalue in Admin UI - Message - Delete user that had messages in DM and other chats
- No messages of deleted user remain
Expected behavior:
User account should be deleted, but messages in chat history should remain and be authored as deleted user (when that user was on server, for example UserA @usera)
Actual behavior:

Server Setup Information:
- Version of Rocket.Chat Server: 4.2.0
- Operating System: CentOS7
- Deployment Method: docker
- Number of Running Instances: 10
- DB Replicaset Oplog: Enabled
- NodeJS Version: 12.22.1
- MongoDB Version: 4.2.17
Client Setup Information
- Desktop App or Browser Version: Chrome 96
- Operating System: Windows 10
Additional context
Tested on 3.18.3 with same result
Third option look like work fine

Relevant logs:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Admin UI Message Erasure Type setting and follow the user deletion flow described in the reproduction steps. Reproduce the Keep Messages And User Name case, compare it with Delete All Messages and the third option, and consider the issue done when deleted users' messages remain attributed to the deleted user while the account is removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, typescript
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100