-
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
Include yourself and @here options in mentions auto-suggestion list #19221
Conversation
@puneetlath @eVoloshchak One of you needs to 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] |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-05-23.at.17.08.35.movMobile Web - ChromeScreen_Recording_20230523-171305_Chrome.mp4Mobile Web - SafariScreen.Recording.2023-05-23.at.17.09.35.movDesktopScreen.Recording.2023-05-23.at.17.11.33.moviOSScreen.Recording.2023-05-23.at.17.10.27.movAndroidScreen_Recording_20230523-173115_New.Expensify.mp4 |
} | ||
const sortedPersonalDetails = _.sortBy(_.values(personalDetails), (detail) => detail.displayName || detail.login); | ||
_.each(sortedPersonalDetails, (detail) => { | ||
if (searchValue && !`${detail.displayName} ${detail.login}`.trim().includes(searchValue)) { |
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 (searchValue && !`${detail.displayName} ${detail.login}`.trim().includes(searchValue)) { | |
if (searchValue && !`${detail.displayName} ${detail.login}`.trim().includes(searchValue) || suggestions.length >= CONST.AUTO_COMPLETE_SUGGESTER.MAX_AMOUNT_OF_ITEMS) { |
I think we can do something like this to avoid calling .includes
for all the participants we're not displaying
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's also a bug with search being case-sensitive. I think this can be resolved by calling .toLocaleLowerCase()
for both searchValue
and ${detail.displayName} ${detail.login}
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.
@eVoloshchak This makes sense but I'm struggling to understand the reason for the condition that you suggested above ie
suggestions.length >= CONST.AUTO_COMPLETE_SUGGESTER.MAX_AMOUNT_OF_ITEMS
I think adding it will cause the search results to be incorrect.
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've fixed the bug related to the casing of the search value.
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 what he is saying is to only sort the matches, instead of sorting the whole personalDetails object. Since the results will always be a subset.
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.
@puneetlath Handled.
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 adding it will cause the search results to be incorrect.
I think I'm missing something, could you explain how? Essentially what I was trying to achieve is to stop iterating over personalDetails
once we already have 5 items in suggestions array
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.
Hm... I get you now. But we had to sort all of the records. Can you check the new approach which I did? It allows us to sort and loop over only the filtered records.
Co-authored-by: Eugene Voloshchak <copyreading@gmail.com>
return true; | ||
}); | ||
|
||
const sortedPersonalDetails = _.sortBy(filteredPersonalDetails, (detail) => detail.displayName || detail.login); |
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 could use _.first(sortedPersonalDetails, 5)
to get the first 5 of these, then do the _.each
. That way you wouldn't be wasting time pushing suggestions that are just going to get sliced. I think that would resolve @eVoloshchak's concern.
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.
@puneetlath Pushed with suggested changes.
62f27ee
to
1b91882
Compare
getMentionOptions(personalDetails, searchValue = '') { | ||
const suggestions = []; | ||
|
||
if (CONST.MENTION_SUGGESTER.HERE_TEXT.includes(searchValue)) { |
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.
Should be CONST.AUTO_COMPLETE_SUGGESTER.HERE_TEXT
, just realized it already exists
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.
@eVoloshchak Are you sure? I can't see 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.
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.
Oh, I meant CONST.AUTO_COMPLETE_SUGGESTER
already exists, let's move HERE_TEXT
there
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.
@eVoloshchak Gotcha. I've fixed 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.
LGTM!
cc: @puneetlath
✋ 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/puneetlath in version: 1.3.18-0 🚀
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 1.3.18-0 🚀
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 1.3.18-0 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.3.18-2 🚀
|
getMentionOptions(personalDetails, searchValue = '') { | ||
const suggestions = []; | ||
|
||
if (CONST.AUTO_COMPLETE_SUGGESTER.HERE_TEXT.includes(searchValue)) { |
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.
This line caused a regression in #19645. We should have used searchValue.toLowerCase()
to match both upper and lowercase characters.
Details
This PR adds option to mention oneself or all the room members using
@here
text.Fixed Issues
$ #18746
PROPOSAL: #18746 (comment)
Tests
@h
and verify thathere
option shows up.@your email
and verify that the option shows up.Offline tests
N/A
QA Steps
@h
and verify thathere
option shows up.@your email
and verify that the option shows up.PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
Screen.Recording.2023-05-19.at.2.23.18.AM.mov
Mobile Web - Chrome
Screen.Recording.2023-05-19.at.2.26.03.AM.mov
Mobile Web - Safari
Screen.Recording.2023-05-19.at.2.24.24.AM.mov
Desktop
Screen.Recording.2023-05-19.at.2.23.46.AM.mov
iOS
Screen.Recording.2023-05-19.at.2.44.47.AM.mov
Android
Screen.Recording.2023-05-19.at.2.26.34.AM.mov