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-09-18] [$1000] Both English & Spanish Emoji are present while making default language spanish #25735

Closed
1 of 6 tasks
m-natarajan opened this issue Aug 22, 2023 · 70 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

Comments

@m-natarajan
Copy link

m-natarajan commented Aug 22, 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:

Case 1:While making English as default language
1.login to app
2.go to settings
3. click on Preferences
4. choose language English
5. go to any chat composer
6. Type :fuego and clear
7. type :fire
8. In this case, you don't see any result while searching with spanish emoji name
Case 2:While making Spanish as default language
1.login to app
2.go to settings
3. click on Preferences
4. choose language Spanish
5. go to any chat composer
6. Type :fuego and clear
7. type :fire
8. In this case, you see result while searching with spanish emoji as well as english emoji

Expected Result:

While making spanish as a default language, english emoji should be hidden

Actual Result:

While making spanish as a default language, both spanish & english emoji should are shown

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.3.56-14
Reproducible in staging?: Yes
Reproducible in production?: Yes
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

Screen.Recording.2023-08-14.at.5.00.00.PM.1.mov
Recording.389.mp4

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0192922d7d2b8409c8
  • Upwork Job ID: 1694408125906583552
  • Last Price Increase: 2023-08-30
  • Automatic offers:
    • jjcoffee | Reviewer | 26437177
    • Thanos30 | Contributor | 26437178
    • lincolnb17 | Reporter | 26437179
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 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

@Thanos30
Copy link
Contributor

Thanos30 commented Aug 23, 2023

Proposal Updated

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

When in Spanish language, we get suggestion for English emojis too.

What is the root cause of that problem?

The root cause of the problem is on EmojiTrie.js file.

On line 22, we have: const names = isDefaultLocale ? [name] : [...new Set([name, item.name])];

(@jjcoffee As you can see here, if the isDefaultLocale is false, we are passing a Set on the names, which includes both the preferredLanguage name (Spanish) and the item.name, which is the English one.)

, which adds both the spanish name and the english name on the list.

Basically, we add an English Trie node with the suggestion's name in English, which won't match the equivalent Spanish emoji, so it gets added as a separate match

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

We still want users to be able to use the english names of emojis, as they are universally preferred.
In order to achieve that, instead of passing both languages names for each emoji as we do now, if the preferred language is not English, we will pass the English name of the emoji to the tire, suggesting the Spanish emoji.

This way, the english name of the emoji will reference the Spanish one.

An important notice is that when we are in Spanish and search for example :fire, we want :fuego: to appear first. For that reason, we will be adding the suggestion of the english name before all the other suggestions.

In order to achieve that, instead of keeping both names in a variable, we should keep the separately, and add to our trie only the preferred language names:

        const englishName = item.name;
        const preferredLanguageName = _.get(langEmojis, [item.code, 'name'], englishName);
        
        // Add the actual name of the emoji for the current language
        const node = trie.search(preferredLanguageName);
        if (!node) {
            trie.add(preferredLanguageName, {code: item.code, types: item.types, name: preferredLanguageName, suggestions: []});
        } else {
            trie.update(preferredLanguageName, {code: item.code, types: item.types, name: preferredLanguageName, suggestions: node.metaData.suggestions});
        }

After doing that, we will include the keyword suggestions of both languages in our trie (already doing that).

Finally, after checking that the user is not using English, we will proceed to add the English names as reference to the Spanish ones:

        if (!isDefaultLocale) {
            const englishNode = trie.search(englishName);
            if (!englishNode) {
                trie.add(englishName, {suggestions: [{code: item.code, types: item.types, name: preferredLanguageName}]});
            } else {
                trie.update(englishName, {
                    ...englishNode.metaData,
                    suggestions: [{code: item.code, types: item.types, name: preferredLanguageName}, ...englishNode.metaData.suggestions],
                });
            }
        }

As you can see here: suggestions: [{code: item.code, types: item.types, name: preferredLanguageName}, ...englishNode.metaData.suggestions] , we make sure the english name suggestion comes first!

Another important thing is that we want a valid emoji code to be immediately replaced when the user has set Spanish as the preferred language and types the emoji in English (e.x :fire: should be replaced with the fire emoji if the user is in Spanish).

For that reason, we should add the below code on EmojiUtils.js , at replaceEmojis function, line 322:

        let checkEmoji = trie.search(name);
        if ((!checkEmoji || !checkEmoji.metaData.code) && lang !== CONST.LOCALES.DEFAULT) {
            const englishTrie = emojisTrie[CONST.LOCALES.DEFAULT];
            if (englishTrie) {
                const englishEmoji = englishTrie.search(name);
                checkEmoji = englishEmoji;
            }
        }

Video of Solution:

Screen.Recording.2023-08-23.at.4.56.35.AM.mov

@CortneyOfstad CortneyOfstad added the External Added to denote the issue can be worked on by a contributor label Aug 23, 2023
@melvin-bot melvin-bot bot changed the title Both English & Spanish Emoji are present while making default language spanish [$1000] Both English & Spanish Emoji are present while making default language spanish Aug 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 23, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0192922d7d2b8409c8

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

melvin-bot bot commented Aug 23, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 23, 2023

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

@studentofcoding
Copy link
Contributor

What's the expected result on English language @m-natarajan @CortneyOfstad ? Will it show both English Emoji & Spanish or only English? Thanks

@CortneyOfstad
Copy link
Contributor

@studentofcoding the expected result is that if English is set as the default, then the emojis would be listed in English (Spanish = Spanish), not having both available when one language is set as the preference over the other 👍

@s-alves10
Copy link
Contributor

This is an intentional behavior. Please check #16086 (comment)

cc @0xmiroslav @stitesExpensify @iwiznia

@jjcoffee
Copy link
Contributor

@CortneyOfstad This is a feature, not a bug 😄 It was intentionally added in this PR as @s-alves10 points out.

@Thanos30
Copy link
Contributor

@jjcoffee @CortneyOfstad @s-alves10 I do agree that users should be able to use the english words to search for emojis, but showing all emojis in both versions is kinda strange.

In my 2nd solution on my proposal, a Spanish user can search for :fire , and he will see the :fuego: emoji, which I believe is a better approach on that, not to have duplicate emojis on the suggestions.

@lincolnb17
Copy link

@Thanos30 exactly, i also felt the same

@jjcoffee
Copy link
Contributor

@Thanos30 Hmm can you show an example where duplicate emojis show? That would be more of an issue if that's the case.

@Thanos30
Copy link
Contributor

Thanos30 commented Aug 24, 2023

@jjcoffee Sure, a small example would be here:
image

:bomb: and :bomba: both appear

@jjcoffee
Copy link
Contributor

@Thanos30 Thanks! That does seem like unexpected behaviour. Any chance you have a couple more examples?

I might need to field some opinions on Slack for expected behaviour here, as I'm not sure searching in English and displaying the Spanish result will always feel intuitive.

@m-natarajan Could you update the issue results section to the following:

Expected Result:

When the language is set to Spanish, searching in English should not result in duplicate emoji listings

Actual Result:

When the language is set to Spanish, searching in English results in duplicate emoji listings

@Thanos30
Copy link
Contributor

@jjcoffee I do understand, indeed this won't be that visible in most cases. But, as per my proposal, we could still keep the ability to search using english names, but display only the default language results. I personally think it's the smoothest approach, but let me know what you think!

Thanks!

@jjcoffee
Copy link
Contributor

Asked on Slack.

@jjcoffee
Copy link
Contributor

Okay, pretty strong response on Slack all in favour of Searching in English simply displays the Spanish result (Search: ":bomb", Result displayed: ":bomba"), as in @Thanos30's proposal (alternative solution).

@Thanos30 As a rule we normally don't accept code diffs in proposals. Could you add some more detail to your proposal about your approach for the alt solution (what you're changing (links to files/line refs help) and why). Thanks!

@Thanos30
Copy link
Contributor

Sure @jjcoffee , give me one moment please

@Thanos30
Copy link
Contributor

@jjcoffee Updated my proposal to focus only on the crucial parts of the change, also added an extra change I noticed. Thank you for your patience 🙏

@jjcoffee
Copy link
Contributor

@Thanos30 Thanks for the update and good catch with the immediate replacement!

Looking at your proposal again, I'm not sure if your RCA covers the behaviour we're now looking at (with language set to Spanish, searching in English can result in duplicate emoji listings). So we're still missing out on the "why" this issue is happening. Do you think you could clarify that section?

@Thanos30
Copy link
Contributor

@jjcoffee Of course, let me update the proposal for that part!

@Thanos30
Copy link
Contributor

@jjcoffee edited the proposal and tagged you on the part that explains how both language names are suggested.

@jjcoffee
Copy link
Contributor

jjcoffee commented Sep 4, 2023

@Thanos30 Thanks, and no worries - Android is giving everyone trouble these days 😅 I'll review the PR as a priority tomorrow!

@johnmlee101
Copy link
Contributor

I think we can go with the old payments system since this was started beforehand

@CortneyOfstad
Copy link
Contributor

@jjcoffee just checking to see if there was an update on the PR review? TIA!

@jjcoffee
Copy link
Contributor

jjcoffee commented Sep 8, 2023

@CortneyOfstad Just waiting for the internal engineer to review the PR!

@Thanos30
Copy link
Contributor

Thanos30 commented Sep 8, 2023

I thought this was deliberately postponed due to the PR freeze mentioned in Slack, that's why I didn't bump anyone. This was ready and approved in less than 3 days too 😁

@jjcoffee
Copy link
Contributor

jjcoffee commented Sep 8, 2023

@Thanos30 That's most likely what happened. I think the bonus can still apply as long as the engineer doesn't require further changes (see e.g. here on Slack).

@Thanos30
Copy link
Contributor

Thanos30 commented Sep 8, 2023

@jjcoffee Ay, I know, thanks 🙏

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @Thanos30 got assigned: 2023-08-31 17:27:09 Z
  • when the PR got merged: 2023-09-11 02:40:15 UTC
  • days elapsed: 6

On to the next one 🚀

@Thanos30
Copy link
Contributor

@jjcoffee PR got merged without any further change requests after all. Since we had it complete within the 3 days period, are we eligible for the bonus if everything goes well?

Thank you all 🙏

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Sep 11, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Both English & Spanish Emoji are present while making default language spanish [HOLD for payment 2023-09-18] [$1000] Both English & Spanish Emoji are present while making default language spanish Sep 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.67-3 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-09-18. 🎊

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 — @lincolnb17 paid $250 for reporting bug
  • Contributor that fixed the issue — @Thanos30 paid $1,000 as Contributor
  • Contributor+ that helped on the issue and/or PR — @jjcoffee paid $1,000 as C+

For reference, here are some details about the assignees on this issue:

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 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:

  • [@jjcoffee] The PR that introduced the bug has been identified. Link to the PR:
  • [@jjcoffee] 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:
  • [@jjcoffee] 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:
  • [@jjcoffee] Determine if we should create a regression test for this bug.
  • [@jjcoffee] 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.
  • [@CortneyOfstad] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@jjcoffee
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: feat: support Spanish emojis #20828
  • 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: feat: support Spanish emojis #20828 (comment)
  • 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: N/A
  • Determine if we should create a regression test for this bug. No - this would be difficult to test for as it didn't occur for all emoji searches
  • 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. N/A

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 Daily KSv2 Overdue labels Sep 18, 2023
@CortneyOfstad
Copy link
Contributor

@Thanos30 this is not eligible for the bonus at this time, but standard payment is being made now 👍

@CortneyOfstad
Copy link
Contributor

Payments are completed. Closing!

@Thanos30
Copy link
Contributor

Okay @CortneyOfstad , Thank you 🙏

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
Projects
None yet
Development

No branches or pull requests

9 participants