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

オープン 初心者向け
#1,437 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@yashsarvaiya45 がすでに取り組んでいます。

2026年11月17日 から。

  • #1438 @yashsarvaiya45 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, react
領域
frontend

調査の方向性

packages/react/src/views/Message/MessageToolbox.jsから始め、表示条件のチェック、options useMemo の依存配列、surfaceOptions のマッピングに注目してください。音声メッセージと動画メッセージで編集およびコピーのアクションがどのように動作すべきか、また編集中の状態がどのように表現されるかを確認してください。報告された3つの問題が修正され、権限の読み込みに応じてツールボックスのアクションが正しく更新されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Description

In packages/react/src/views/Message/MessageToolbox.js, there are three bugs affecting message action visibility and state updates:

  1. Unused isVisibleForMessageType check & missing optional chaining: isVisibleForMessageType is computed on lines 93–95 to hide text-only actions (edit and copy) on audio/mpeg and video/mp4 messages, but it is never applied to options.edit.visible or options.copy.visible. Additionally, message.files?.[0].type lacks optional chaining on [0], which can throw a TypeError when message.files is an empty array [].
  2. Stale useMemo dependencies for role permissions: The options useMemo hook omits isAllowedToEditMessage, canDeleteMessage, isAllowedToReport, isVisibleForMessageType, and handleCopyMessageLink from its dependency array. When user roles and permissions load asynchronously, the memoized options object fails to recompute, leaving Edit, Delete, and Report actions hidden or stale.
  3. Dropped color and ghost props in surfaceOptions: options.edit defines color and ghost properties to highlight active editing state (isEditing), but surfaceOptions omits these properties when mapping items for SurfaceMenu.
Affected File
  • packages/react/src/views/Message/MessageToolbox.js (lines 93–218)
Expected Behavior
  • Apply isVisibleForMessageType (with safe optional chaining message.files?.[0]?.type) to edit and copy visibility.
  • Include all permission flags and handlers in the options useMemo dependency array so toolbox actions update when roles resolve.
  • Forward color and ghost properties in surfaceOptions.
主要言語
JavaScript
スター
170
フォーク
397
平均マージ
8日 20時間
マージ済み PR(30日)
6

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

RocketChat/EmbeddedChat のほかの issue

RocketChat/EmbeddedChat の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。