Bug: Unused media visibility check and missing useMemo dependencies cause stale/invalid actions in MessageToolbox.js
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, react
- 领域
- frontend
调研方向
从 packages/react/src/views/Message/MessageToolbox.js 开始,重点检查可见性判断、options useMemo 依赖数组以及 surfaceOptions 映射。确认音频和视频消息的编辑与复制操作应如何表现,以及活动编辑状态如何表示。修复报告的三个问题,并确保权限加载时工具箱操作能够正确更新,即为完成。
由索引模型根据 Issue 内容生成。
描述
Description
In packages/react/src/views/Message/MessageToolbox.js, there are three bugs affecting message action visibility and state updates:
- Unused
isVisibleForMessageTypecheck & missing optional chaining:isVisibleForMessageTypeis computed on lines 93–95 to hide text-only actions (editandcopy) onaudio/mpegandvideo/mp4messages, but it is never applied tooptions.edit.visibleoroptions.copy.visible. Additionally,message.files?.[0].typelacks optional chaining on[0], which can throw aTypeErrorwhenmessage.filesis an empty array[]. - Stale
useMemodependencies for role permissions: TheoptionsuseMemohook omitsisAllowedToEditMessage,canDeleteMessage,isAllowedToReport,isVisibleForMessageType, andhandleCopyMessageLinkfrom its dependency array. When user roles and permissions load asynchronously, the memoizedoptionsobject fails to recompute, leavingEdit,Delete, andReportactions hidden or stale. - Dropped
colorandghostprops insurfaceOptions:options.editdefinescolorandghostproperties to highlight active editing state (isEditing), butsurfaceOptionsomits these properties when mapping items forSurfaceMenu.
Affected File
packages/react/src/views/Message/MessageToolbox.js(lines 93–218)
Expected Behavior
- Apply
isVisibleForMessageType(with safe optional chainingmessage.files?.[0]?.type) toeditandcopyvisibility. - Include all permission flags and handlers in the
optionsuseMemodependency array so toolbox actions update when roles resolve. - Forward
colorandghostproperties insurfaceOptions.
- 主要语言
- JavaScript
- 星标
- 170
- 派生
- 397
- 平均合并
- 8 天 20 小时
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
RocketChat/EmbeddedChat 的其他 Issue
-
bug(layout-editor): theme refinements like "change it to dark" are ignored with AI providers可能已有人在做 @arshil42 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
RocketChat/EmbeddedChat#1433 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
RocketChat/EmbeddedChat#1432 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
RocketChat/EmbeddedChat#1431 ·
维护者通常 1 天内回复
-
bug: editing a multi-line message saves literal \n instead of line breaks可能已有人在做 @arshil42 今天认领。 未关闭
难度 1/5 1-3 小时 新手友好度 92/100
RocketChat/EmbeddedChat#1430 · 3 条评论 ·
维护者通常 1 天内回复
-
Nested inline code, emoji and mentions disappear inside bold, italic and strikethrough可能已有人在做 @gitseraj 于 1 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
RocketChat/EmbeddedChat#1429 · 2 条评论 ·
维护者通常 1 天内回复
查看 RocketChat/EmbeddedChat 的全部 Issue
相似的 Issue
-
accepted enhancement
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
channels:edit check:passed
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复