-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[MentionsV2] Room mentions suggestions #39697
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider using just ReportUtils.isChatRoom
?
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'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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 😉 |
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.
LGTM ✔️
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.
Works great!
Just a couple of typos
@@ -171,6 +171,12 @@ type ComposerWithSuggestionsProps = ComposerWithSuggestionsOnyxProps & | |||
/** The parent report ID */ | |||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** Whether chat is a reoprt from group policy */ | |
/** Whether chat is a report from group policy */ |
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 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.suggestedMentions = suggestions; | ||
nextState.shouldShowSuggestionMenu = !!suggestions.length; | ||
} | ||
|
||
const shouldDisplayMenetionsSuggestions = isGroupPolicyReport && (isValidRoomName(suggestionWord.toLowerCase()) || prefix === ''); |
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.
typo
const shouldDisplayMenetionsSuggestions = isGroupPolicyReport && (isValidRoomName(suggestionWord.toLowerCase()) || prefix === ''); | |
const shouldDisplayMentionsSuggestions = isGroupPolicyReport && (isValidRoomName(suggestionWord.toLowerCase()) || prefix === ''); |
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.
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 |
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.
Looks good!
All yours @puneetlath
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.
Looks good! Just a comment about comments 😄
@@ -12,17 +12,17 @@ import Avatar from './Avatar'; | |||
import Text from './Text'; | |||
|
|||
type Mention = { | |||
/** Display name of the user */ | |||
/** Display name of the mention */ |
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.
/** Display name of the mention */ | |
/** Display text of the mention */ |
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? Actually not sure.
alternateText: string; | ||
|
||
/** Email/phone number of the user */ | ||
login?: string; | ||
/** handle of the mention */ |
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'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 😄 |
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.
Thanks for updating! Let's just make the capitalization consistent and then I'm happy :)
Co-authored-by: Puneet Lath <[email protected]>
Done! 🎉 |
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.
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 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
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