RocketChat / RocketChat/Rocket.Chat

Reactions aren't transferred when changing usernames or deleting accounts

Open
#20,425 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feat: message triaged
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

Once you change your username or delete the account, the reactions aren't transferred/removed. This can turn out to be a significant flaw for its usage as a polling mechanism or even new accounts having the remnant reactions of an old/changed account.

The reactions are stored in the message objects in a very raw format. If you :heart_eyes: react something, it is stored as
"reactions" : { ":heart_eyes:" : { "usernames" : [ username ] }}
This makes querying to find reactions by username infeasible.
It would be better to migrate to a structure like:
"reactions" : [ { "type": ":heart_eyes:", "usernames": [ username ] }]
This might take a bit more space in the document but allows manipulation of the reactions by usernames.

Steps to reproduce:
Expected behavior:

For the reactions to be transferred/deleted.

Actual behavior:

The reactions aren't changed.

Server Setup Information:
  • Version of Rocket.Chat Server: 3.11.0-develop
  • Operating System: Ubuntu 20.10
  • Deployment Method: develop
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: 12.18.4 - x64
  • MongoDB Version: 4.2.8
Client Setup Information
  • Desktop App or Browser Version: Chrome Version 87.0.4280.88
  • Operating System: Ubuntu 20.10
Additional context
Relevant logs:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review how reactions are stored in message objects and how username changes or account deletion are handled. Reproduce both cases, then verify that reactions are transferred or removed as expected; the issue provides no file or test names.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, typescript
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.