Repository navigation
Support read only messages - #40010
Conversation
…b.com/barttom/App-expensify into feature/38773-support-read-only-messages
…ture/38773-support-read-only-messages
….com/rezkiy37/Expensify into feature/38773-support-read-only-messages
…ture/38773-support-read-only-messages
…ture/38773-support-read-only-messages
…ture/38773-support-read-only-messages
…ture/38773-support-read-only-messages
| type BannerProps = { | ||
| /** Text to display in the banner. */ | ||
| text: string; | ||
| text?: string; |
There was a problem hiding this comment.
Why did this become optional? A banner without text sounds weird.
There was a problem hiding this comment.
That's because I've added the content property for a case when I need to pass a react node, not a simple text.
| return report?.permissions?.includes(CONST.REPORT.PERMISSIONS.WRITE); | ||
| } | ||
|
|
||
| return true; |
There was a problem hiding this comment.
If permissions are not an array or the array length is 0, I think this should return false?
There was a problem hiding this comment.
I think yes, because it is a new property and I am not sure if it is applied to all kinds of reports. If we return false then all legacy chats will be "read-only".
cc @mountiny
There was a problem hiding this comment.
In Web, we do not return the permissions and we dont return it from the getChats method hence in OpenApp (which uses that method) we also do not include permissions. Its only added in the structureReportForOnyx
There was a problem hiding this comment.
We however return this in the OpenReport using the getStructuredOnyxReportAndLastMessageData
So actually the only one I found that does not have the permissions is the selfDM 🤔 although I see the report should be shared with read, write permissions cc @thienlnam
There was a problem hiding this comment.
Ah this is because the user owns the report and is so is not in the sharedReports table. Maybe we can an owner check and then populate those permissions in the response
There was a problem hiding this comment.
I propose to name this SystemChatReportFooterMessage
| /** Saved onboarding purpose selected by the user */ | ||
| choice: OnyxEntry<OnboardingPurposeType>; | ||
|
|
||
| /** Collection of reports */ |
There was a problem hiding this comment.
Which reports? All users reports?
There was a problem hiding this comment.
Yeah, the app is looking for an admin chat to show in the banner.
There was a problem hiding this comment.
There is another way: to the active policyID by nvp_expensify_activePolicyID and find an admin chat. Let me try.
There was a problem hiding this comment.
What do you think about this approach - 90a72e9?
There was a problem hiding this comment.
There is a problem when the user creates a new account, the active policy does not exist yet.
| }, | ||
| copyReferralLink: 'Copy invite link', | ||
| }, | ||
| onboardingBottomMessage: { |
There was a problem hiding this comment.
I propose to name this systemChatFooterMessage
| </View> | ||
| )} | ||
| {shouldRenderHTML ? ( | ||
| {content && content} |
There was a problem hiding this comment.
NAB: Should we use a Boolean here? I feel like it looks a bit more readable that way
| {content && content} | |
| {!!content && content} |
| return report?.permissions?.includes(CONST.REPORT.PERMISSIONS.WRITE); | ||
| } | ||
|
|
||
| return true; |
There was a problem hiding this comment.
We however return this in the OpenReport using the getStructuredOnyxReportAndLastMessageData
So actually the only one I found that does not have the permissions is the selfDM 🤔 although I see the report should be shared with read, write permissions cc @thienlnam
|
|
||
| fieldList?: Record<string, PolicyReportField>; | ||
|
|
||
| permissions?: Array<ValueOf<typeof CONST.REPORT.PERMISSIONS>>; |
There was a problem hiding this comment.
There should be a comment here
|
As only NAB comments are here and we got C+ and 2 approvals, I will merge before deploy |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/mountiny in version: 1.4.67-0 🚀
|
|
This PR is failing because of issue #38773 The issue is reproducible in: All environments 1714237983181.bandicam_2024-04-27_20-02-58-191.mp41714238446211.video_2024-04-27_20-20-32.mp41714238916895._____________2024-04-27___20.24.27.mp41714238585094.video_2024-04-27_20-22-52.mp41714239337019.video_2024-04-27_20-35-08.mp4 |
|
Seems this PR caused a regression #41135 (comment) |
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.4.67-7 🚀
|
1 similar comment
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.4.67-7 🚀
|
| isOptimisticReport: reportProp?.isOptimisticReport, | ||
| lastMentionedTime: reportProp?.lastMentionedTime, | ||
| avatarUrl: reportProp?.avatarUrl, | ||
| permissions: reportProp?.permissions, |
There was a problem hiding this comment.
When a user signs-in via google after viewing a public room, the permissions was not getting updated. A deep comparison was required here to update the dependency. This caused #41955 where the composer was not getting displayed even after signing-in via google.
| containerStyles={[styles.archivedReportFooter]} | ||
| shouldShowIcon | ||
| icon={Expensicons.Lightbulb} | ||
| content={<Text suppressHighlighting>{content}</Text>} |
There was a problem hiding this comment.
You have left the styles.flex1 style in this Text component, which overflowed the content in iOS. More context #43115
| originalReportID={originalReportID ?? ''} | ||
| isArchivedRoom={ReportUtils.isArchivedRoom(report)} | ||
| displayAsGroup={displayAsGroup} | ||
| disabledActions={!ReportUtils.canWriteInReport(report) ? RestrictedReadOnlyContextMenuActions : []} |
There was a problem hiding this comment.
Coming from #43562, we also missed adding those disabledActions in the context menu.


Details
The app blocks actions for read-only chats. Also, the app shows a new footer instead of the composer.
Note: to test the read-only chats optimistically, you would need #40678
Note: to test the PR I would recommend adding a couple of lines to optimistically make the Concierge chat a read-only one. Example - 23b0ba0 (you can revert this commit - ace67dc).
Note: you can run the flow as many times as you want by adding a test button into TestToolMenu.tsx.
Details
Fixed Issues
$ #38773
PROPOSAL: N/A
Tests
Offline tests
Same as "Tests".
QA Steps
Same as "Tests".
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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
Android: Native
Android: mWeb Chrome
Android.Chrome.mp4
iOS: Native
IOS.mp4
iOS: mWeb Safari
IOS.Safari.mp4
MacOS: Chrome / Safari
Chrome.mp4
MacOS: Desktop
Desktop.mp4