-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support read only messages #40010
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
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid.movAndroid: mWeb Chromeandroid.chrome.moviOS: Nativeios.moviOS: mWeb SafariScreen.Recording.2024-04-26.at.21.50.14.movMacOS: Chrome / SafariScreen.Recording.2024-04-26.at.21.41.23.movScreen.Recording.2024-04-26.at.21.39.16.movScreen.Recording.2024-04-26.at.21.42.07.movMacOS: DesktopDesktop.mov |
@@ -17,7 +18,13 @@ import Tooltip from './Tooltip'; | |||
|
|||
type BannerProps = { | |||
/** Text to display in the banner. */ | |||
text: string; | |||
text?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this become optional? A banner without text sounds weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to name this SystemChatReportFooterMessage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - 9076bc0.
/** Saved onboarding purpose selected by the user */ | ||
choice: OnyxEntry<OnboardingPurposeType>; | ||
|
||
/** Collection of reports */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which reports? All users reports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the app is looking for an admin chat to show in the banner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about this approach - 90a72e9?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a problem when the user creates a new account, the active policy does not exist yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test.mp4
src/languages/en.ts
Outdated
@@ -2763,6 +2763,16 @@ export default { | |||
}, | |||
copyReferralLink: 'Copy invite link', | |||
}, | |||
onboardingBottomMessage: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to name this systemChatFooterMessage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - 62b193a.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fill={StyleUtils.getIconFillColor(getButtonState(shouldHighlight))} | ||
/> | ||
</View> | ||
)} | ||
{shouldRenderHTML ? ( | ||
{content && content} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -187,6 +187,8 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback< | |||
transactionThreadReportID?: string; | |||
|
|||
fieldList?: Record<string, PolicyReportField>; | |||
|
|||
permissions?: Array<ValueOf<typeof CONST.REPORT.PERMISSIONS>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 🚀
|
@@ -210,6 +210,7 @@ function ReportScreen({ | |||
isOptimisticReport: reportProp?.isOptimisticReport, | |||
lastMentionedTime: reportProp?.lastMentionedTime, | |||
avatarUrl: reportProp?.avatarUrl, | |||
permissions: reportProp?.permissions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have left the styles.flex1
style in this Text component, which overflowed the content in iOS. More context #43115
@@ -914,6 +915,7 @@ function ReportActionItem({ | |||
originalReportID={originalReportID ?? ''} | |||
isArchivedRoom={ReportUtils.isArchivedRoom(report)} | |||
displayAsGroup={displayAsGroup} | |||
disabledActions={!ReportUtils.canWriteInReport(report) ? RestrictedReadOnlyContextMenuActions : []} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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