[CP Staging] fix: Allow editing sent messages when chat "Who can post" in chat is set to "Admins only"#90912
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@hungvu193 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
|
||
| const chatFooterStyles = {...styles.chatFooter, minHeight: !isOffline ? CONST.CHAT_FOOTER_MIN_HEIGHT : 0}; | ||
|
|
||
| const renderComposerSwipeable = (isEditOnly = false) => ( |
There was a problem hiding this comment.
❌ CLEAN-REACT-PATTERNS-4 (docs)
renderComposerSwipeable and renderComposer (line 101) are internal render helper functions defined inside the component body. They close over the entire component scope, preventing React Compiler from independently memoizing them, and they hide the actual render tree from the component's return statements.
Extract these into standalone components with explicit props:
function ComposerSwipeable({reportID, isEditOnly}: {reportID: string; isEditOnly?: boolean}) {
return (
<SwipeableView onSwipeDown={Keyboard.dismiss}>
<ReportActionCompose reportID={reportID} isEditOnly={isEditOnly} />
</SwipeableView>
);
}Then use <ComposerSwipeable reportID={reportIDFromRoute} /> and <ComposerSwipeable reportID={reportIDFromRoute} isEditOnly /> directly in the JSX return statements.
Reviewed at: a365d18 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
Valid, addressed!
| const {editingReportActionID} = useReportActionActiveEdit(); | ||
|
|
||
| // Narrow-screen edits use the bottom composer (#90516); mount it when a draft exists even if posting is admin-only. | ||
| const shouldShowComposerForActiveEditDraft = shouldUseNarrowLayout && editingReportActionID !== null; |
There was a problem hiding this comment.
❌ CONSISTENCY-3 (docs)
The expression shouldUseNarrowLayout && editingReportActionID !== null is duplicated in both ReportFooter.tsx (line 84) and ReportActionsList.tsx (line 846). Both files import useReportActionActiveEdit and useResponsiveLayout to compute the same derived boolean.
Consider extracting this into a shared hook:
function useShouldShowComposerForActiveEditDraft() {
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {editingReportActionID} = useReportActionActiveEdit();
return shouldUseNarrowLayout && editingReportActionID !== null;
}This keeps the logic in one place and avoids the two files drifting apart if the condition changes.
Reviewed at: a365d18 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
Valid, addressed!
|
@chrispader Can you address AI comment? I'll review again in the morning. |
@mountiny @hungvu193 addressed all comments. This is ready! |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-05-18.at.09.28.23.mov |
mountiny
left a comment
There was a problem hiding this comment.
Looks good to me, thank you
There was a problem hiding this comment.
@chrispader in the follow up, can you make sure you add unit test for this hook
|
🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
…egression-admin-only-room [CP Staging] fix: Allow editing sent messages when chat "Who can post" in chat is set to "Admins only" (cherry picked from commit ccfc9c7) (cherry-picked to staging by mountiny)
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.3.75-3 🚀
Bundle Size Analysis (Sentry): |
|
Yes, help site updates are needed. PR #90912 allows non-admin members to edit their previously sent messages in admin-only rooms, but the current docs imply members can't do anything in those rooms. Changes made in draft PR: #90972
|
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.3.75-10 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes required. This PR fixes a bug where members couldn't edit previously sent messages in "admin only" chat rooms on narrow screens. It restores expected behavior rather than introducing new user-facing functionality. I reviewed the relevant help site articles:
Since the docs don't make any incorrect claims about this behavior, no updates are needed. |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.75-14 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.3.76-0 🚀
|
|
No help site changes are required for this PR. This is a bug fix that restores the ability for non-admin members to edit their previously sent messages in "Admins only" chat rooms on narrow screens. It doesn't introduce any new features, settings, or user-facing behavior changes — it corrects a rendering regression in the composer component. The existing help site articles (Expensify-Chat-Rooms-for-Admins.md, Chat-Features-and-Moderation-Tools.md) already correctly describe the "Admins only" posting restriction and don't make claims about editing behavior that would need updating. |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.77-3 🚀
|
@mountiny @hungvu193
Explanation of Change
This PR fixes an issue where in "admin only" chat rooms previously sent messages are not editable.
In a follow-up PR, i'm refactoring the
ReportActionComposeinto more compositionalsub-components, to prevent the need for thisisEditOnlyboolean flag, which doesn't comply with React compositional best practices. For the sake of fixing this deploy blocker, i think we can introduce it temporarily and refactor afterwards.Fixed Issues
$ #90889
PROPOSAL:
Tests
Precondition:
Offline tests
None needed.
QA Steps
Same as in Tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
MacOS: Chrome / Safari
Screen.Recording.2026-05-17.at.16.24.14.mov