[MentionsV2] Room mentions suggestions#39697
Conversation
|
@paultsimura 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] |
|
@rlinoz could you please give me access to the doc, or attach the screenshots of the relevant section? |
|
This PR enables room mentions in any report that belongs to the same policy (e.g. in policy expense chats, expense reports, threads in them, etc.), while the issue description says it should be available only in policy rooms – what is the real expectation here? |
src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx
Outdated
Show resolved
Hide resolved
src/pages/home/report/ReportActionCompose/SuggestionMention.tsx
Outdated
Show resolved
Hide resolved
| if (!ReportUtils.isGroupPolicy(report) || !isValidRoomName(report?.reportName ?? '')) { | ||
| // checking validity of room name removes Policy Expense Chats | ||
| return; | ||
| } |
There was a problem hiding this comment.
Did you consider using just ReportUtils.isChatRoom?
There was a problem hiding this comment.
I'm not entirely convinced that isChatRoom would be the best fit here. This check seems to filter out reports that are not connected with group policy, while the additional room name validation check filters out the Policy Expense chats.
I'm not deeply familiar with report handling, so if you believe isChatRoom would work well in this context based on your experience, I'm open to it.
There was a problem hiding this comment.
From a discussion in Slack:
Please create a separate function in ReportUtils:
function canReportBeMentionedWithinPolicy(report: OnyxEntry<Report>, policyId: string): boolean {
if (report?.policyID !== policyId) {
return false;
}
return isChatRoom(report) && !isThread(report);
}And use it for filtering the reports here.
src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx
Outdated
Show resolved
Hide resolved
I updated the issue, but we should be able to mention policy rooms in any report that belongs to a policy. |
|
@robertKozik could you please merge |
…omMentionsSuggestions
|
@paultsimura done! |
|
@robertKozik please address this as well: https://github.com/Expensify/App/pull/39697/files#r1557984758 |
|
I'll be filling the checklist in the meantime |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid09.18.mp4Android: mWeb Chromechrome09.18.mp4iOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-04-10.at.09.15.3709.18.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-04-10.at.09.14.5909.18.mp4MacOS: Chrome / SafariScreen.Recording.2024-04-10.at.08.58.1609.07.mp4MacOS: DesktopScreen.Recording.2024-04-10.at.09.02.2609.07.mp4 |
Sure, done 😉 |
rlinoz
left a comment
There was a problem hiding this comment.
Works great!
Just a couple of typos
| // eslint-disable-next-line react/no-unused-prop-types -- its used in the withOnyx HOC | ||
| parentReportID: string | undefined; | ||
|
|
||
| /** Whether chat is a reoprt from group policy */ |
There was a problem hiding this comment.
| /** Whether chat is a reoprt from group policy */ | |
| /** Whether chat is a report from group policy */ |
There was a problem hiding this comment.
I don't think we should say "chat" here. I think it's just:
| /** Whether chat is a reoprt from group policy */ | |
| /** Whether report is from group policy */ |
| nextState.shouldShowSuggestionMenu = !!suggestions.length; | ||
| } | ||
|
|
||
| const shouldDisplayMenetionsSuggestions = isGroupPolicyReport && (isValidRoomName(suggestionWord.toLowerCase()) || prefix === ''); |
There was a problem hiding this comment.
typo
| const shouldDisplayMenetionsSuggestions = isGroupPolicyReport && (isValidRoomName(suggestionWord.toLowerCase()) || prefix === ''); | |
| const shouldDisplayMentionsSuggestions = isGroupPolicyReport && (isValidRoomName(suggestionWord.toLowerCase()) || prefix === ''); |
There was a problem hiding this comment.
| const shouldDisplayMenetionsSuggestions = isGroupPolicyReport && (isValidRoomName(suggestionWord.toLowerCase()) || prefix === ''); | |
| const shouldDisplayRoomMentionsSuggestions = isGroupPolicyReport && (isValidRoomName(suggestionWord.toLowerCase()) || prefix === ''); |
This variable is only for room mentions, right?
|
cc @shawnborton |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Testing on slack it seems quite random though |
|
Sorting would be a simple change, let me know if we decided on implementing it 👀 |
|
I think we can go ahead and sort alphabetically and later decide on a better way. |
|
@rlinoz done |
|
@robertKozik looks good to me, but lint is upset |
|
Damn, didn't noticed - should be alright now |
|
Do you think we can merge it today? It will unblock the live search issue |
rlinoz
left a comment
There was a problem hiding this comment.
Looks good!
All yours @puneetlath
puneetlath
left a comment
There was a problem hiding this comment.
Looks good! Just a comment about comments 😄
|
|
||
| type Mention = { | ||
| /** Display name of the user */ | ||
| /** Display name of the mention */ |
There was a problem hiding this comment.
| /** Display name of the mention */ | |
| /** Display text of the mention */ |
There was a problem hiding this comment.
I think? Actually not sure.
|
|
||
| /** Email/phone number of the user */ | ||
| login?: string; | ||
| /** handle of the mention */ |
There was a problem hiding this comment.
I'm not totally understanding from these prop descriptions what the difference between text, alternateText, and handle is. Maybe we could make these comments a bit more descriptive?
|
@puneetlath updated the comments. Please check if now it's more descriptive 😄 |
puneetlath
left a comment
There was a problem hiding this comment.
Thanks for updating! Let's just make the capitalization consistent and then I'm happy :)
Co-authored-by: Puneet Lath <puneet@expensify.com>
|
Done! 🎉 |
puneetlath
left a comment
There was a problem hiding this comment.
Thanks for bearing with me
|
✋ 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/rlinoz in version: 1.4.63-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.63-21 🚀
|


Details
This PR introduces suggestions support for new type of mentions - room mentions.
Fixed Issues
$ #39532
PROPOSAL: N/A - design doc
Tests
#prefix), verify that suggestions are displayed above the composer.Offline tests
Same as test steps
QA Steps
Same as test steps
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
Screen.Recording.2024-04-05.at.13.00.54.mov
Android: mWeb Chrome
Screen.Recording.2024-04-05.at.13.28.01.mov
iOS: Native
Screen.Recording.2024-04-05.at.13.47.21.mov
iOS: mWeb Safari
Screen.Recording.2024-04-05.at.13.34.55.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
Screen.Recording.2024-04-05.at.13.39.42.mov