RocketChat / RocketChat/Rocket.Chat

[3.6.0] User actions menu gets out of sync

Open
#19,726 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description:

User actions appear to cache in certain conditions, causing the menu to become "stale".

The very confusing caveat here is that everything works as expected when running on localhost. The exact same code and meteor version will produce the issue as described below only when deployed to our non-localhost environment. Because of this, I don't think it's a code problem. Our DEV environment (where the issue is observed) is running behind an nginx reverse proxy. That's the only difference I can point to as causing a potential issue.

Steps to reproduce:

There are several ways to reproduce. A few places I see it happen are on the user actions when looking at members in a room, and also from the users directory in the admin section. Entirely possible it could be happening elsewhere too.

  1. Go to members list of a private room
  2. Use the "..." button next to a user to make them owner, leader, or moderator (all exhibit the same behavior)
  3. The green toast message appears at the top saying the user action was successful.
  4. Click the "..." again to see user options.
  5. Observe the button you clicked "Set as..." still says "Set as..." rather than "Remove as..." as expected.

Clicking the same action again rightfully complains that the user is already an owner/moderator/leader, etc. This appears to be a caching issue since CTRL-SHIFT reload on Chrome or Safari will do a hard reload and the option appears as expected.

Another way to reproduce is to click on the username in the members list and click the button for the action "Set As" (same method as using the "..." and also the same behavior. You will see it also gets out of sync by relying on the cache (I think) instead of rebuilding the menu options.

A final way to see this is under Admin/Users where you can use the "Make Admin" button to provide a similar assignment to a user.

Expected behavior:

The menu should know that the user has already been given the owner/leader/moderator/admin role and should update the menu item to say "Remove As" or vice versa, without needing a CTRL-SHIFT reload.

Actual behavior:

The options don't refresh and you still see "Set As" after you assign the role, or "Remove As" after you have already removed the role.

Server Setup Information:
  • Version of Rocket.Chat Server: 3.6.0
  • Operating System: RedHat
  • Deployment Method: meteor npm start directly from source
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version: 12.6.1
  • MongoDB Version: 4.2.5
Client Setup Information
  • Desktop App or Browser Version: Chrome 87.0.4280.67
  • Operating System: OSX
Additional context

I don't know if this could be caused by nginx, but that seems like the only difference between localhost and DEV. Again, everything works fine on localhost with the same exact code.

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

Start by reproducing the stale user-action menu from a private room's members list, the user profile action, and Admin/Users using the role assignment controls. Compare the menu state after assigning or removing a role without a hard reload; done means the labels change from "Set As" to "Remove As" or back immediately.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, nginx, node.js, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.