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 2024-04-15] [$500] iOS - Chat - Strikethrough not applied for multiline hyperlinks deleted offline #38680

Closed
1 of 6 tasks
lanitochka17 opened this issue Mar 20, 2024 · 25 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

@lanitochka17
Copy link

lanitochka17 commented Mar 20, 2024

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


Version Number: 1.4.55-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4441552
Issue reported by: Applause - Internal Team

Action Performed:

  1. Log in to New Expensify
  2. Navigate to any chat
  3. Send multiline hyperlink
  4. Disable the internet connection
  5. Delete the message

Expected Result:

The message should be grayed out with strikethrough formatting applied to indicate that the deletion is pending

Actual Result:

The message is grayed out but the strikethrough is not applied

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6420587_1710946305742.SUGF1463.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ef21d15df0bfd5a6
  • Upwork Job ID: 1770552279000301568
  • Last Price Increase: 2024-03-20
  • Automatic offers:
    • mollfpr | Reviewer | 0
    • bernhardoj | Contributor | 0
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 20, 2024
Copy link

melvin-bot bot commented Mar 20, 2024

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

@lanitochka17
Copy link
Author

@puneetlath FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@bernhardoj
Copy link
Contributor

bernhardoj commented Mar 20, 2024

Proposal

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

The strikethrough/deleted styles aren't applied to multi-line links when deleting it while offline.

What is the root cause of that problem?

When we have a single line link, the anchor renderer will have 1 text as the child that contains the link text. It gets the style from the parent.

<Text
ref={linkRef}
style={StyleSheet.flatten([style, defaultTextStyle])}

style={[style, parentStyle, styles.textUnderlinePositionUnder, styles.textDecorationSkipInkNone]}

There are 2 styles that affect it, style and parentStyle. style contains the anchor tag style, and parentStyle contains the strikethrough style and the important style is textDecorationLine. style textDecorationLine value is underline, while parentStyle textDecorationLine is line-through and it overwrites the style one.

But for multi-line links, there are multiple children (MemoizedTNodeRenderer) of the component. If we have a multi-line link like this:

[multi
line](google.com)

then the children will be 3: multi, br, line.

Screenshot 2024-03-21 at 00 01 56

The parent text contains the strikethrough style that I explained above, but each child here also contains the anchor tag style. Based on this upstream issue, it's not possible to have both line-through and underline styles, that's why for multi-line links, we see the underline styles.

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

We can render the children for a multi-line link by ourselves by using renderChildren props of TNodeChildrenRenderer.

<TNodeChildrenRenderer tnode={tnode} />

and to have both underline and strikethrough, we can use textDecorationLine: 'underline line-through' style.

const hasStrikethroughStyle = 'textDecorationLine' in parentStyle && parentStyle.textDecorationLine === 'line-through';
const textDecorationLineStyle = hasStrikethroughStyle ? {textDecorationLine: 'underline line-through'} : {};

return (
    <AnchorForCommentsOnly ...
        // add textDecorationLineStyle here
        style={[style, parentStyle, textDecorationLineStyle, styles.textUnderlinePositionUnder, styles.textDecorationSkipInkNone]}
    >
        <TNodeChildrenRenderer
            tnode={tnode}
            // renderChild is only called for multi-line link
            renderChild={(props) => {
                if (props.childTnode.tagName === 'br') {
                    return <Text>{'\n'}</Text>
                }
                if (props.childTnode.type === 'text') {
                    // and here
                    return <Text style={[props.childTnode.getNativeStyles(), parentStyle, textDecorationLineStyle, styles.textUnderlinePositionUnder, styles.textDecorationSkipInkNone]}>{props.childTnode.data}</Text>
                }
                return props.childElement;
            }}
        />
    </AnchorForCommentsOnly>
);

we can further improve this if there is any missing style

@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label Mar 20, 2024
Copy link

melvin-bot bot commented Mar 20, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01ef21d15df0bfd5a6

@melvin-bot melvin-bot bot changed the title iOS - Chat - Strikethrough not applied for multiline hyperlinks deleted offline [$500] iOS - Chat - Strikethrough not applied for multiline hyperlinks deleted offline Mar 20, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 20, 2024
Copy link

melvin-bot bot commented Mar 20, 2024

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

@mollfpr
Copy link
Contributor

mollfpr commented Mar 22, 2024

@bernhardoj The result on Android is missing the underline, is this expected?

Prev
Screenshot_1711110933

After
Screenshot_1711110999

@bernhardoj
Copy link
Contributor

Oh, you're right, that's because the parentStyle overwrites the underline style. I think we should use renderChildren for iOS only. What do you think?

AnchorRenderer
|- index.tsx
|- childRenderer
|--- index.ts (will just return undefined)
|--- index.ios.ts

@mollfpr
Copy link
Contributor

mollfpr commented Mar 22, 2024

Simulator Screenshot - iPhone 15 Pro 17 2 - 2024-03-22 at 19 14 48

That might be work, but I think we need to fix the underline too on iOS.

@bernhardoj
Copy link
Contributor

As mentioned in my proposal, it's an upstream issue for iOS, that's why I propose it to customize the children renderer so we prioritize the strikethrough style. It also happens for a single line without my solution.

@bernhardoj
Copy link
Contributor

There is an option to use both though based on React native docs.
https://www.github.com/meliorence/react-native-render-html/issues/529

I will play around and see whether it works for react-native-render-html.

@bernhardoj
Copy link
Contributor

Okay, it works, I have updated my proposal to include it for both single and multi-line.
image

so far I tested and it works for both web and native

@mollfpr
Copy link
Contributor

mollfpr commented Mar 22, 2024

The proposal from @bernhardoj looks good to me!

🎀 👀 🎀 C+ reviewed!

Copy link

melvin-bot bot commented Mar 22, 2024

Current assignee @puneetlath is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@melvin-bot melvin-bot bot added the Overdue label Mar 25, 2024
@puneetlath
Copy link
Contributor

Sounds good to me.

@melvin-bot melvin-bot bot removed the Overdue label Mar 25, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 25, 2024
Copy link

melvin-bot bot commented Mar 25, 2024

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

Offer link
Upwork job

Copy link

melvin-bot bot commented Mar 25, 2024

📣 @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 melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Mar 26, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @mollfpr

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Apr 8, 2024
@melvin-bot melvin-bot bot changed the title [$500] iOS - Chat - Strikethrough not applied for multiline hyperlinks deleted offline [HOLD for payment 2024-04-15] [$500] iOS - Chat - Strikethrough not applied for multiline hyperlinks deleted offline Apr 8, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 8, 2024
Copy link

melvin-bot bot commented Apr 8, 2024

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

Copy link

melvin-bot bot commented Apr 8, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.60-13 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 2024-04-15. 🎊

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

Copy link

melvin-bot bot commented Apr 8, 2024

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:

  • [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
  • [@mollfpr] 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:
  • [@mollfpr] 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:
  • [@mollfpr] Determine if we should create a regression test for this bug.
  • [@mollfpr] 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.
  • [@puneetlath] 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 labels Apr 14, 2024
@puneetlath
Copy link
Contributor

@mollfpr bump on the checklist. And on accepting the Upwork offer.

@bernhardoj has been paid.

@mollfpr
Copy link
Contributor

mollfpr commented Apr 16, 2024

@puneetlath I'll do manual request in NewDot, could you create the payment summary? Thank you!

[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
[@mollfpr] 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:

No offending PR.

[@mollfpr] 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:

The regression step should be enough.

[@mollfpr] Determine if we should create a regression test for this bug.
[@mollfpr] 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. Send a single and multi-line link to any chat
  2. Verify the link has underline
  3. Go offline
  4. Delete both links
  5. Verify the link has underline and line through
  6. 👍 or 👎

@puneetlath
Copy link
Contributor

Regression test issue here: https://github.com/Expensify/Expensify/issues/388565

Payment summary:

Thanks everyone!

@JmillsExpensify
Copy link

$500 approved for @mollfpr

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
No open projects
Status: CRITICAL
Development

No branches or pull requests

5 participants