Skip to content
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

[HOLD for payment 2023-05-03] [$1000] Emoji suggestion doesn’t highlight the text in front of another emoji #16626

Closed
2 of 6 tasks
kavimuru opened this issue Mar 28, 2023 · 57 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@kavimuru
Copy link

kavimuru commented Mar 28, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Go to any report, try to type any emoji.
  2. Move the cursor in front of that emoji, try to type another emoji.
  3. Notice that the emoji text is not highlighted in emoji suggestion popup.

Expected Result:

The emoji text should be highlighted.

Actual Result:

The emoji text is not highlighted in emoji suggestion popup.

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.2.90-7
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

RPReplay_Final1679987714.MP4
HYDV7758.1.MP4

Expensify/Expensify Issue URL:
Issue reported by: @hungvu193
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1679990049275629

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01317ca88636cf5943
  • Upwork Job ID: 1642846462865195008
  • Last Price Increase: 2023-04-17
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 28, 2023
@MelvinBot
Copy link

Triggered auto assignment to @laurenreidexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@MelvinBot
Copy link

MelvinBot commented Mar 28, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@MelvinBot
Copy link

@laurenreidexpensify Huh... This is 4 days overdue. Who can take care of this?

@laurenreidexpensify laurenreidexpensify changed the title Emoji suggestion doesn’t highlight the text in front of another emoji iOS Emoji suggestion doesn’t highlight the text in front of another emoji Apr 3, 2023
@laurenreidexpensify laurenreidexpensify changed the title iOS Emoji suggestion doesn’t highlight the text in front of another emoji Emoji suggestion doesn’t highlight the text in front of another emoji Apr 3, 2023
@laurenreidexpensify
Copy link
Contributor

Reproduced this on Mac OS Chrome too

@melvin-bot melvin-bot bot removed the Overdue label Apr 3, 2023
@laurenreidexpensify laurenreidexpensify added the External Added to denote the issue can be worked on by a contributor label Apr 3, 2023
@melvin-bot melvin-bot bot changed the title Emoji suggestion doesn’t highlight the text in front of another emoji [$1000] Emoji suggestion doesn’t highlight the text in front of another emoji Apr 3, 2023
@MelvinBot
Copy link

Job added to Upwork: https://www.upwork.com/jobs/~01317ca88636cf5943

@MelvinBot
Copy link

Current assignee @laurenreidexpensify is eligible for the External assigner, not assigning anyone new.

@MelvinBot
Copy link

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (External)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 3, 2023
@MelvinBot
Copy link

Triggered auto assignment to @PauloGasparSv (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@dukenv0307
Copy link
Contributor

dukenv0307 commented Apr 3, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Emoji suggestion doesn’t highlight the text in front of another emoji

What is the root cause of that problem? (Original Bug)

We are using this logic to get the prefix

prefix={this.state.value.slice(this.state.colonIndex + 1).split(' ')[0]}

Note: We are getting the prefix by getting all characters between the colon index and the first space index

So that in this case the prefix will be smi😄 so that the suggestion is not highlighted because it does not match to the prefix

What is the root cause of that problem? (Bug is mentioned here)

We are splitting the leftText by space or new line

isEmojiCode(str, pos) {
const leftWords = str.slice(0, pos).split(CONST.REGEX.NEW_LINE_OR_WHITE_SPACE);
const leftWord = _.last(leftWords);

So that, if the before of the cursor is emoji, it will not be splitted

What changes do you think we should make in order to solve the problem? (Original Bug)

We should replace the logic to get the prefix by getting all characters between the colon index and the cursor index like this

prefix={this.state.value.slice(this.state.colonIndex + 1, this.state.selection.start)}

What changes do you think we should make in order to solve the problem? (Bug is mentioned here)

We should use new regex to check all space, new line and emoji like that:
NEW_LINE_OR_WHITE_SPACE_OR_EMOJI: /([\uD800-\uDBFF][\uDC00-\uDFFF]|[\n\s])/g,

And use it replace the old regex
const leftWords = str.slice(0, pos).split(CONST.REGEX.NEW_LINE_OR_WHITE_SPACE_OR_EMOJI);

My solution will make behavior similar to slack:
😄:smi --> display suggestion list
text:smi --> don't display suggestion list
assssdw?:smi --> don't display suggestion list

What alternative solutions did you explore? (Optional)

NA

@Pujan92
Copy link
Contributor

Pujan92 commented Apr 3, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Emoji suggestion matched string is not highlighting if it is getting added before the emoji

What is the root cause of that problem?

The prefix prop which we are passing to the EmojiSuggestions component is incorrect which seems to pass extra characters even though the selection end(cursor) isn't includes those chars indexes.

prefix={this.state.value.slice(this.state.colonIndex + 1).split(' ')[0]}

What changes do you think we should make in order to solve the problem?

  1. Need to correct prefix prop value which considers the selection end index as the 2nd parameter for the slice and that won't includes the characters after the selection end index.
prefix={this.state.value.slice(this.state.colonIndex + 1, this.state.selection.end)}
  1. For not showing the emoji suggestions between and after emojis, below changes may required.
  • We do have last colon index before the cursor position here
    const leftString = this.state.value.substring(0, this.state.selection.end);
    const colonIndex = leftString.lastIndexOf(':');
    const isCurrentlyShowingEmojiSuggestion = this.isEmojiCode(this.state.value, this.state.selection.end);
  • In the isEmojiCode we can pass that last colon index and make that function simpler by only considering the pos and lastColonIndex difference.
const isCurrentlyShowingEmojiSuggestion = this.isEmojiCode(this.state.value, colonIndex, this.state.selection.end);
isEmojiCode(str, colonIndex, pos) {
        if (colonIndex !== -1) {
            return pos - colonIndex > 2;
        }
        return false;
}  

Bcoz we only need to consider lastColonIndex before the cursor position till cursor position index to show emoji suggestions. So we can take out extra logic which is to find all the words and take last word, then check whether it starts with colon and its length.

Result
Screen.Recording.2023-04-10.at.9.39.15.PM.mov

@ahmedGaber93
Copy link
Contributor

ahmedGaber93 commented Apr 4, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

emoji text is not highlighted in emoji suggestion popup if is following with onther one without whitespace.

What is the root cause of that problem?

case 1 text before emoji

prefix format depond on whitespace split(' ')

prefix={this.state.value.slice(this.state.colonIndex + 1).split(' ')[0]}

case 2 text after emoji

isEmojiCode depond on split text by whitespace or new line
isEmojiCode("😄:smi", 6) return false see explation

    isEmojiCode(str, pos) {
        const leftWords = str.slice(0, pos).split(CONST.REGEX.NEW_LINE_OR_WHITE_SPACE); 
        // return ["😄:smi"] not [":smi"]
        
        const leftWord = _.last(leftWords);
        // return "😄:smi" not ":smi"
        
        //CONST.REGEX.HAS_COLON_ONLY_AT_THE_BEGINNING will failed becauze text not start with ":"
        return CONST.REGEX.HAS_COLON_ONLY_AT_THE_BEGINNING.test(leftWord) && leftWord.length > 2;
    }

What changes do you think we should make in order to solve the problem?

case 1 text before emoji

split text with Any non-word character split(/[^\w]/)

// split using Any non-word character [^a-zA-Z0-9_]
prefix={this.state.value.slice(this.state.colonIndex + 1).split(/[^\w]/)[0]}

case 2 text after emoji

    isEmojiCode(str, pos) {
       // split using Any non-word character expect ":" [^a-zA-Z0-9_:] 
        const leftWords = str.slice(0, pos).split(/[^\w:]/);
        const leftWord = _.last(leftWords);

        return CONST.REGEX.HAS_COLON_ONLY_AT_THE_BEGINNING.test(leftWord) && leftWord.length > 2;
    }

What alternative solutions did you explore? (Optional)

@Santhosh-Sellavel
Copy link
Collaborator

Will check this tomorrow

@melvin-bot melvin-bot bot added the Overdue label Apr 7, 2023
@laurenreidexpensify
Copy link
Contributor

@Santhosh-Sellavel bump ^^

@melvin-bot melvin-bot bot removed the Overdue label Apr 7, 2023
@Santhosh-Sellavel
Copy link
Collaborator

Ah missed this one will get it today, thanks for the bump!

@Santhosh-Sellavel
Copy link
Collaborator

Emoji suggestions are not shown if typed shorthand immediately after the emoji or between Emojis

Screen.Recording.2023-04-07.at.11.47.10.PM.mov

None of the proposals address all the cases here.

@dukenv0307
Copy link
Contributor

Hi @Santhosh-Sellavel @PauloGasparSv The PR is ready for review

@laurenreidexpensify
Copy link
Contributor

@dukenv0307 can you confirm you've also applied to the job on Upwork? If so, can you confirm you name so I hire the correct person :) ? Thanks

@dukenv0307
Copy link
Contributor

@laurenreidexpensify I've applied, here's my profile https://www.upwork.com/freelancers/~01f5cbe690701118a2
Thanks!

@Pujan92
Copy link
Contributor

Pujan92 commented Apr 18, 2023

@Santhosh-Sellavel @PauloGasparSv just to confirm a point, are we following fully Slack/GitHub emoji suggestions feature? asking bcoz there we don't see suggestions if the selection/cursor position changes. It only shows the suggestions on input text changes.

@Santhosh-Sellavel
Copy link
Collaborator

@Santhosh-Sellavel @PauloGasparSv just to confirm a point, are we following fully Slack/GitHub emoji suggestions feature? asking bcoz there we don't see suggestions if the selection/cursor position changes. It only shows the suggestions on input text changes.

if the selection goes out the minimum length for the suggestion list or we are hiding the list, So I don't see any problem here when moving within the keyword IMO find it useful here.

cc: @PauloGasparSv your thoughts here?

@PauloGasparSv
Copy link
Contributor

cc: @PauloGasparSv your thoughts here?

I also think that's ok! We usually use Slack and other tools to base ourselves and check how we should implement the feature but I also think it works fine the way it was proposed so IMO we should try that : )

Reviewing the P.R. here

@Pujan92
Copy link
Contributor

Pujan92 commented Apr 18, 2023

Thanks for confirming. :)

@laurenreidexpensify
Copy link
Contributor

thanks @dukenv0307 = hired!

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Apr 26, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Emoji suggestion doesn’t highlight the text in front of another emoji [HOLD for payment 2023-05-03] [$1000] Emoji suggestion doesn’t highlight the text in front of another emoji Apr 26, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 26, 2023
@MelvinBot
Copy link

Reviewing label has been removed, please complete the "BugZero Checklist".

@MelvinBot
Copy link

MelvinBot commented Apr 26, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.5-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-05-03. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@MelvinBot
Copy link

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@Santhosh-Sellavel] The PR that introduced the bug has been identified. Link to the PR:
  • [@Santhosh-Sellavel] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@Santhosh-Sellavel] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@Santhosh-Sellavel] Determine if we should create a regression test for this bug.
  • [@Santhosh-Sellavel] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@laurenreidexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 Daily KSv2 labels May 2, 2023
@laurenreidexpensify
Copy link
Contributor

Everyone has been paid - waiting on @Santhosh-Sellavel summary for next steps re: regression testing :)

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented May 3, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

cc: @PauloGasparSv if you differ let me know.

@Santhosh-Sellavel
Copy link
Collaborator

Regression steps

From the PR itself looks good to me

  1. Go to any report, and try to type any emoji.
  2. Move the cursor in front of that emoji, and try to type another emoji.
  3. Verify that the emoji text is highlighted in the emoji suggestion popup.
  4. Move the cursor right after an emoji, and try to type another emoji.
  5. Verify that the emoji suggestion still displays

👍 or 👎

cc: @PauloGasparSv @laurenreidexpensify

@PauloGasparSv
Copy link
Contributor

Sounds good to me @Santhosh-Sellavel!

I also think we should mention how to type the emoji directly in the composer box so people don't confuse the steps with opening the Emoji picker.

What do you think of the following?

  1. Go to any report, and type any emoji in the composer box (you can do that by first typing a comma : and then the emoji name like :smile: the choosing an emoji).
  2. Move the cursor in front of that emoji, and try to type another emoji the same way.
  3. Verify that the emoji text is highlighted correctly in the emoji suggestion popup.
  4. Move the cursor right after an emoji, and try to type another emoji.
  5. Verify that the emoji suggestion is still highlighted and displayed correctly.

@Santhosh-Sellavel
Copy link
Collaborator

Much better Sorry I missed that, seems @dukenv0307 missed adding our suggestion here.

@Santhosh-Sellavel
Copy link
Collaborator

All yours @laurenreidexpensify!

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label May 4, 2023
@laurenreidexpensify
Copy link
Contributor

Great, all steps complete, closing. Nice job everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

8 participants