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-29] [$500] Chat - Inconsistent "(edited)" text on styled RTL text #27125

Closed
1 of 6 tasks
izarutskaya opened this issue Sep 11, 2023 · 32 comments
Closed
1 of 6 tasks
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

@izarutskaya
Copy link

izarutskaya commented Sep 11, 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. Open a chat and type a text in a right-to-left character set, (for example مثال).
  2. Edit the text to another right-to-left text, (for example مال). Examine the "(edited)" text position
  3. Edit the text so it become styled (for example, مال). Examine the "(edited)" text position

Expected Result:

The "(edited)" text is supposed to stay the same for right-to-left characters, regardless being edited or not

Actual Result:

In the normal edited text, the "(edited)" text is positioned in the right of the edited message. However in the styled edited text, the "(edited)" text is positioned on the left of the edited message.

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: v1.3.67-1

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

Styled.RTL.Text.-.Crop.mp4
Recording.1491.mp4

Expensify/Expensify Issue URL:

Issue reported by: @kerupuksambel

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1693864715884909

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01466b9797b975245b
  • Upwork Job ID: 1701135260498452480
  • Last Price Increase: 2023-09-11
  • Automatic offers:
    • bernhardoj | Contributor | 26611890
    • kerupuksambel | Reporter | 26611895
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

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

@melvin-bot
Copy link

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

@bernhardoj
Copy link
Contributor

bernhardoj commented Sep 11, 2023

Proposal

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

Having an edited RTL markdown/styled text put the (edited) text to the left instead of the right like normal text.

What is the root cause of that problem?

In ReportActionItemFragment, we force the report action text to be ltr by applying styles.ltr and convertToLTR (android).

<Text
selectable={!DeviceCapabilities.canUseTouchScreen() || !props.isSmallScreenWidth}
style={[containsOnlyEmojis ? styles.onlyEmojisText : undefined, styles.ltr, ...props.style]}
>
{convertToLTR(props.iouMessage || text)}

However, this only applies to normal text without markdown/styling. Markdown text will be rendered using RenderHTML which is not forced to ltr.

const htmlContent = applyStrikethrough(html + editedTag, isPendingDelete);
return <RenderHTML html={props.source === 'email' ? `<email-comment>${htmlContent}</email-comment>` : `<comment>${htmlContent}</comment>`} />;

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

Force the markdown text to be ltr too by:

  1. Apply ltr style to baseFontStyles.

    App/src/styles/styles.js

    Lines 152 to 153 in ae68e74

    baseFontStyle: {
    color: themeColors.text,

    ...writingDirection.ltr
  2. Alter the HTML text data. In BaseHTMLEngineProvider, wrap all text nodes with convertToLTR by passing a new prop called domVisitors. It will look like this:
domVisitors={{
    onText: (text) => {
        text.data = convertToLTR(text.data);
    }
}}

Then clear the LTR unicode from the text in mention renderer.

// We need to remove the leading @ from data as it is not part of the login
const loginWithoutLeadingAt = props.tnode.data ? props.tnode.data.slice(1) : '';

props.tnode.data.replace('\u2066', '').slice(1)

This will force the text to be LTR for all components that use RenderHTML (Banner, FormAlertWrapper, MoneyRequestAction, and TaskPreview).

@izarutskaya izarutskaya added the External Added to denote the issue can be worked on by a contributor label Sep 11, 2023
@melvin-bot melvin-bot bot changed the title Chat - Inconsistent "(edited)" text on styled RTL text [$500] Chat - Inconsistent "(edited)" text on styled RTL text Sep 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01466b9797b975245b

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

melvin-bot bot commented Sep 11, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

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

@rushatgabhane
Copy link
Member

rushatgabhane commented Sep 11, 2023

looks like a simple solution #27125 (comment)

🎀 👀 🎀

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

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

@bernhardoj
Copy link
Contributor

@rushatgabhane so fast haha, btw I found an issue with my own solution (Android). Appending the HTML with LTR unicode breaks the styling of non-text components.
image

So, I have updated my solution

@rushatgabhane
Copy link
Member

@bernhardoj nice find! Your solution looks good.

@rajsixthblock
Copy link

Contributor details
Your Expensify account email: raj@sixthblock.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0104b18b5cf10d77e5

@mountiny
Copy link
Contributor

is this something we actually support now @rushatgabhane this is a first time I am seeing something like that and I am not sure if this is worth spending our time on, right now. What do you think?

@bernhardoj
Copy link
Contributor

@mountiny we don't support RTL by forcing the message text to LTR, but this does not work if the message is a markdown.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

📣 @rushatgabhane Please request via NewDot manual requests for the Reviewer role ($500)

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

📣 @bernhardoj 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

📣 @kerupuksambel 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@mountiny
Copy link
Contributor

Ok thanks, I think your solution looks good but it will touch lots of places so make sure to really test properly

@bernhardoj
Copy link
Contributor

It's nearly midnight already at my place, I will create the PR tomorrow.

@mountiny
Copy link
Contributor

yeah I am also in Bali 😂

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 12, 2023
@bernhardoj
Copy link
Contributor

@mountiny yeah, I saw the flag on your Slack status 😂 but I'm actually on a different island that is 1h+ flights apart from Bali 😞

Btw, PR is ready!

@melvin-bot
Copy link

melvin-bot bot commented Sep 19, 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 @bernhardoj got assigned: 2023-09-11 15:00:04 Z
  • when the PR got merged: 2023-09-19 06:32:00 UTC
  • days elapsed: 5

On to the next one 🚀

@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 22, 2023
@melvin-bot melvin-bot bot changed the title [$500] Chat - Inconsistent "(edited)" text on styled RTL text [HOLD for payment 2023-09-29] [$500] Chat - Inconsistent "(edited)" text on styled RTL text Sep 22, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.72-11 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-29. 🎊

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

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 22, 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:

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

@rushatgabhane
Copy link
Member

rushatgabhane commented Sep 25, 2023

  1. The PR that introduced the bug has been identified. Link to the PR: I couldn't find the PR. But we should add a regression test

  2. 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: N.A.

  3. 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.

  4. Determine if we should create a regression test for this bug. YES

  5. 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 -

    1. Open any chat
    2. Send an RTL text, for example, مثال
    3. Edit the text by applying some style, for example مثال (strikethrough)
    4. Verify the text is on the left and (edited) text is on the right

@rushatgabhane
Copy link
Member

Created a manual request here - https://staging.new.expensify.com/r/7161765702402744

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

melvin-bot bot commented Oct 2, 2023

@JmillsExpensify, @rushatgabhane, @mountiny, @bernhardoj Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot
Copy link

melvin-bot bot commented Oct 4, 2023

@JmillsExpensify, @rushatgabhane, @mountiny, @bernhardoj Eep! 4 days overdue now. Issues have feelings too...

@mountiny
Copy link
Contributor

mountiny commented Oct 4, 2023

$50 to @kerupuksambel
$500 to @bernhardoj
$500 to @rushatgabhane already requested in NewDot

@melvin-bot melvin-bot bot removed the Overdue label Oct 4, 2023
@JmillsExpensify
Copy link

$500 payment approved for @rushatgabhane based on summary above.

@JmillsExpensify
Copy link

All other contributors have been paid out!

@JmillsExpensify
Copy link

Regression test has also been created. Closing.

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

6 participants