Skip to content

fix(react): apply media visibility guard and fix useMemo dependencies in MessageToolbox - #1438

Open
yashsarvaiya45 wants to merge 1 commit into
RocketChat:developfrom
yashsarvaiya45:fix/messagetoolbox-visibility-and-memo-deps
Open

yashsarvaiya45 wants to merge 1 commit into
RocketChat:developfrom
yashsarvaiya45:fix/messagetoolbox-visibility-and-memo-deps

Conversation

@yashsarvaiya45

Copy link
Copy Markdown
Contributor

Description

Fixes #1437

Fixed three visibility and stale-state issues in packages/react/src/views/Message/MessageToolbox.js:

  • Applied isVisibleForMessageType (with safe optional chaining message.files?.[0]?.type) to options.edit.visible and options.copy.visible so text-only actions are hidden on audio and video messages.
  • Added missing permission flags and handlers (isAllowedToEditMessage, canDeleteMessage, isAllowedToReport, isVisibleForMessageType, and handleCopyMessageLink) to the options useMemo dependency array so actions update properly when user roles resolve asynchronously.
  • Forwarded color and ghost props in surfaceOptions to preserve active editing state styling.

Testing

  • Formatted with Prettier and verified all workspace lint checks pass (yarn lint).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Unused media visibility check and missing useMemo dependencies cause stale/invalid actions in MessageToolbox.js

1 participant