Fixes ability to mention reports for room invited users - #40506
Conversation
|
@jasperhuangg 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] |
|
|
||
| // When we invite someone to a room they don't have the policy type, but we still want them to be able see and click on report mentions, so we also check the reportType in case the policyType was empty. | ||
| const isGroupPolicyReport = useMemo( | ||
| () => (currentReport && !isEmptyObject(currentReport) ? ReportUtils.isGroupPolicy(currentReport) || ReportUtils.isChatRoom(currentReport) : false), |
There was a problem hiding this comment.
Will this account for all report types on policies? Expense reports, workspace chats, transaction threads, user created rooms, default rooms, etc?
There was a problem hiding this comment.
I don't think you can invite people into Expense reports, workspace chats and transaction threads.
So, for invited people it should account for created and default rooms, and for policy members it should account for all the ones you mentioned.
There was a problem hiding this comment.
Oh you actually can invite to the workspace chat via whispers.
But even if you do it is kind of broken..not sure what is the expected behavior here.
There was a problem hiding this comment.
Asked about it here.
But thinking better about this, I believe that if a report has a policy that is not _FAKE_ we should render the mention.
So we should be able to change this check to currentReport.policyID && currentReport.policyID !== CONST.POLICY.ID_FAKE.
There was a problem hiding this comment.
That makes sense to me.
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
|
|
||
| // When we invite someone to a room they don't have the policy object, but we still want them to be able to see and click on report mentions, so we only check if the policyID in the report is from a workspace | ||
| const isGroupPolicyReport = useMemo( | ||
| () => (currentReport && !isEmptyObject(currentReport) ? !!currentReport.policyID && currentReport.policyID !== CONST.POLICY.ID_FAKE : false), |
There was a problem hiding this comment.
I find the ternary here a bit hard to follow. A ternary seems like a weird choice for this type of condition. Is this the same as saying?
(currentReport && !isEmptyObject(currentReport) && !!currentReport.policyID && currentReport.policyID !== CONST.POLICY.ID_FAKE : false),
(currentReport && !isEmptyObject(currentReport) && !!currentReport.policyID && currentReport.policyID !== CONST.POLICY.ID_FAKE
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
|
I believe backend is, for now, removing the mention tags when room is not existing (I've compared the request payload and the backend response - correct me if I'm wrong with this @rlinoz ). Try mentioning already existing room. |
|
Yeah, basically what Robert said. Another thing that can point to outdated node modules is if the mention is not highlighted in the composer. |
1 similar comment
|
Yeah, basically what Robert said. Another thing that can point to outdated node modules is if the mention is not highlighted in the composer. |
Julesssss
left a comment
There was a problem hiding this comment.
Cool, thanks both for the explanation.
|
✋ 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/Julesssss in version: 1.4.66-0 🚀
|
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 1.4.66-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.66-5 🚀
|


Details
This fixes the behavior of when to show the auto complete widget for report mentions and when to parse report mentions in the reportActions list for users that are not members of a policy but got invited to a room.
cc: @robertKozik
Fixed Issues
$ https://github.com/Expensify/Web-Expensify/pull/41654#issuecomment-2065259420
PROPOSAL:
Tests
Preconditions: Have user A and user B, where user A is member of the policy and user B isn't.
#announce#and see that the auto complete widget shows upOffline tests
Preconditions: Have user A and user B, where user A is member of the policy and user B isn't.
#and see that the auto complete widget shows upQA Steps
Preconditions: Have user A and user B, where user A is member of the policy and user B isn't.
#announce#and see that the auto complete widget shows upPR 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
iOS: Native
iOS: mWeb Safari
Screen.Recording.2024-04-18.at.18.36.45.mov
MacOS: Chrome / Safari
Screen.Recording.2024-04-18.at.18.26.51.mov
MacOS: Desktop