Skip to content

Fix readonly room member action to show Unmute for effectively muted users#39317

Draft
Copilot wants to merge 3 commits into
developfrom
copilot/fix-mute-unmute-readonly-room
Draft

Fix readonly room member action to show Unmute for effectively muted users#39317
Copilot wants to merge 3 commits into
developfrom
copilot/fix-mute-unmute-readonly-room

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 4, 2026

In readonly rooms, the member action menu could incorrectly show Mute user even when the target user was already effectively muted by readonly semantics. This change aligns action labeling with actual mute state resolution in readonly rooms.

  • Readonly mute-state resolution

    • Extracted mute-state logic into a dedicated helper:
      client/views/room/hooks/useUserInfoActions/actions/getUserIsMuted.ts
    • Updated readonly behavior to treat users as muted by default, except when explicitly listed in room.unmuted.
    • Preserved post-readonly nuance when a readonly room has an explicit room.muted list.
  • Hook integration

    • useMuteUserAction now consumes the extracted helper so action content (Mute user vs Unmute user) is derived from the corrected state calculation.
  • Targeted coverage

    • Added useMuteUserAction.spec.ts with focused cases for:
      • readonly default-muted behavior
      • readonly explicit-unmuted behavior
      • readonly + post-readonly + explicit muted-list behavior
if (room?.ro) {
  if (Array.isArray(room.unmuted) && room.unmuted.indexOf(username) !== -1) {
    return false;
  }

  if (userCanPostReadonly) {
    const roomHasNoMutedList = !Array.isArray(room.muted) || room.muted.length === 0;
    return roomHasNoMutedList || room.muted.indexOf(username) !== -1;
  }

  return true;
}

https://github.com/user-attachments/assets/71b8680b-a17e-434f-8c43-55423a823967

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fastdl.mongodb.org
    • Triggering command: /home/REDACTED/.npm/_npx/2ad0c2d1aba2dd61/node_modules/node/bin/node /home/REDACTED/.npm/_npx/2ad0c2d1aba2dd61/node_modules/node/bin/node ./postinstall.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>mute/unmute user on readonly room</issue_title>
<issue_description><!--

Please see our guide for opening issues: https://rocket.chat/docs/contributing/reporting-issues

If you have questions or are looking for help/support please see: https://rocket.chat/docs/getting-support

If you are experiencing a bug please search our issues to be sure it is not already present: https://github.com/RocketChat/Rocket.Chat/issues

-->

Description:

On readonly room the user action menu always shows mute user even that all users are mute

Steps to reproduce:

  1. Create new room
  2. add a user to it
  3. set the room readonly
  4. room members action menu does not show unmute user

Expected behavior:

  1. if user is muted show unmute user
  2. if user is unmuted show mute user

Actual behavior:

room members action menu does not show unmute user

Server Setup Information:

  • Version of Rocket.Chat Server: 5.4.1
  • Operating System: ubuntu server
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version: v14.19.3
  • MongoDB Version: 5.0.14

Client Setup Information

  • Desktop App or Browser Version: both
  • Operating System: ubuntu 22.04

Additional context

Relevant logs:

</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: Bug Resolution Agent
A focused agent that resolves GitHub issues by applying minimal, test-driven fixes.
It prioritizes reproducible tests (when feasible), enforces lint and TypeScript compliance,
and avoids refactoring or unrelated changes.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented Mar 4, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project
  • This PR has an invalid title

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 4, 2026

⚠️ No Changeset found

Latest commit: bb29912

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI and others added 2 commits March 4, 2026 04:24
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Co-authored-by: ggazzo <5263975+ggazzo@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix mute/unmute user action in readonly room Fix readonly room member action to show Unmute for effectively muted users Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mute/unmute user on readonly room

2 participants