-
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
Add mention suggestions #18469
Add mention suggestions #18469
Conversation
@puneetlath @0xmiroslav 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] |
If we show suggestions in full width and above composer, what's Make auto-complete component work inline for? |
BUG1:
bug1.movQuestion: |
Mention logic should be a bit different from emoji logic. |
I've noticed small bug after I've implemented the feedback, working on it now |
fixed |
It seems like this is the default behavior of the composer, as it is reproducible with plain text as well |
The fix that I've commited closes the emoji/mention suggestions on the first ESC press (if they're present), and clears the text input on the second press. |
This can be out of scope but you already did good job! I like this behavior. Thoughts @puneetlath? I believe this is not a blocker but just to confirm: |
Agreed, that seems good to me too!
Ah, yes. @here should be an option. We can add that in follow-up though. |
Small bug:
bug2.movThis doesn't happen on emoji code |
Bug but NAB since it also happens on emoji suggestions (@puneetlath we can create new issue for tracking if not already reported) Arrow up/down always loop with 5 even though suggestions list is less than 5 bug3.mov |
How do we handle phone users? They're not recognized as mention because phone number has spaces bug4.mov |
I think QA Steps is wrong. Is there any difference between Recent report and New report in design doc? |
In theory, there will always be at least one suggestion of Concierge. |
I updated the QA steps. Do you think that's better @0xmiroslav? |
yes that's clear. So list data is not related to report but contacts |
Reviewer Checklist
Screenshots/VideosWebweb1.movweb2.movMobile Web - Chromemchrome.movMobile Web - Safarimsafari.movDesktopdesktop.moviOSios.movAndroidandroid.mov |
Alright! Going to go ahead and merge this baby. |
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.
Here's summary of follow-up issues:
- suggestions view position (Add mention suggestions #18469 (comment))
- suggestions don't disappear when move cursor to the start position (Add mention suggestions #18469 (comment))
- Arrow up/down always loop with 5 even though suggestions list is less than 5 (Add mention suggestions #18469 (comment))
- support phone users
- suggestions still remaining after send and composer cleared
- space is added endlessly while keep selecting suggested user (Add mention suggestions #18469 (review))
- arrow index is not within range and show console error (Add mention suggestions #18469 (comment))
- add myself in suggestions list
- add @here in suggestions list, maybe only for group chat
Thanks for making the list!
Will be fixed automatically in: #16078
Looks like it was already fixed by @szebniok in this PR
Will be fixed in: #16426
Created issue: #18729
Reported here: https://expensify.slack.com/archives/C049HHMV9SM/p1683751749650109
Issue here: #18742
Created issue here: #18744
Created issue for this here: #18746 |
🚀 Deployed to staging by https://github.com/puneetlath in version: 1.3.13-0 🚀
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.3.13-5 🚀
|
} | ||
|
||
LayoutAnimation.configureNext(LayoutAnimation.create(50, LayoutAnimation.Types.easeInEaseOut, LayoutAnimation.Properties.opacity)); | ||
|
||
this.setState(nextState); | ||
} | ||
|
||
calculateMentionSuggestion() { | ||
if (this.state.selection.end < 1) { |
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.
@szebniok This change caused this bug. Could you help to explain why we need to add this? Could we use !this.state.value
instead of this.state.selection.end
< 1?
cc @0xmiroslav @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.
@dukenv0307 this is how it's done for the existing emoji suggestion feature, so I'm guessing we just replicated that behavior for mentions.
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 should have called the resetSuggestions
as we do for Emoji Suggestions but we missed that here.
We added the |
The I don't think any checklist update is required. |
const mentionCode = `@${mentionObject.alternateText}`; | ||
const commentAfterAtSignWithMentionRemoved = this.state.value.slice(this.state.atSignIndex).replace(CONST.REGEX.MENTION_REPLACER, ''); | ||
|
||
this.updateComment(`${commentBeforeAtSign}${mentionCode} ${commentAfterAtSignWithMentionRemoved}`, 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.
Regardless of whether the commentAfterAtSignWithMentionRemoved
begins with a space or not, we consistently include an additional space. This caused a regression.
personalDetails: { | ||
key: ONYXKEYS.PERSONAL_DETAILS, | ||
}, |
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 we didn't need this b/c we already had the hoc withPersonalDetails(),
if ((e.key === CONST.KEYBOARD_SHORTCUTS.ENTER.shortcutKey || e.key === CONST.KEYBOARD_SHORTCUTS.TAB.shortcutKey) && this.state.suggestedEmojis.length) { | ||
const suggestionsExist = this.state.suggestedEmojis.length > 0 || this.state.suggestedMentions.length > 0; | ||
|
||
if ((e.key === CONST.KEYBOARD_SHORTCUTS.ENTER.shortcutKey || e.key === CONST.KEYBOARD_SHORTCUTS.TAB.shortcutKey) && suggestionsExist) { |
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 #19624 ✋
Not a regression. We want to skip the selection when pressing Shift + Enter as Slack does.
Details
Fixed Issues
$ #17890
Tests
Offline tests
QA Steps
Users you've chatted with before
@
sign into the text inputUsers you haven't chatted with before
@
sign into the text inputrandom@gmail.com
)PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.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-08.at.14.21.21.mov
Mobile Web - Chrome
Screen.Recording.2023-05-09.at.11.58.48.mov
Mobile Web - Safari
Screen.Recording.2023-05-09.at.12.29.37.mov
Desktop
Screen.Recording.2023-05-08.at.14.26.26.mov
iOS
Screen.Recording.2023-05-09.at.12.27.32.mov
Android
Screen.Recording.2023-05-09.at.12.25.54.mov