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-06-28] [$250] Android - Chat - Emoji with markdown on edit cut off on top #43394

Closed
1 of 6 tasks
lanitochka17 opened this issue Jun 10, 2024 · 17 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

@lanitochka17
Copy link

lanitochka17 commented Jun 10, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.81-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: https://expensify.testrail.io/index.php?/tests/view/4613726
Issue reported by: Applause - Internal Team

Action Performed:

  1. Launch app
  2. Tap on a report
  3. Enter
  4. Send the message
  5. Long press and tap edit comment
  6. Enter 😄😃
  7. Save it

Expected Result:

Emoji with markdown on edit must not cut off on top

Actual Result:

Emoji with markdown on edit cut off on top

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

Bug6508219_1718032465293.Screenrecorder-2024-06-10-19-44-51-391_compress_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b3f0154fe463e8cd
  • Upwork Job ID: 1800920165195401508
  • Last Price Increase: 2024-06-12
  • Automatic offers:
    • akinwale | Reviewer | 102710191
    • bernhardoj | Contributor | 102710194
Issue OwnerCurrent Issue Owner: @sakluger
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 10, 2024
Copy link

melvin-bot bot commented Jun 10, 2024

Triggered auto assignment to @sakluger (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

@sakluger 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 Jun 11, 2024

Proposal

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

Emoji markdown when edited is cut off on top.

What is the root cause of that problem?

When the text is only emoji, the line height will be 35.

App/src/styles/index.ts

Lines 1665 to 1668 in 65db650

onlyEmojisText: {
fontSize: variables.fontSizeOnlyEmojis,
lineHeight: variables.fontSizeOnlyEmojisHeight,
},

When we edit the message, an (edited) text is added at the end of the text. The line height of this is smaller than the emoji, thus the emoji is cut off.

This only started to happen when we render the emoji as a markdown/html. When it was still rendered as a plain text, we already apply the line height style to the edited text, so the issue doesn't happen.

<Text style={[containsOnlyEmojis && styles.onlyEmojisText, styles.ltr, style]}>
<ZeroWidthView
text={text}
displayAsGroup={displayAsGroup}
/>
<Text
style={[
containsOnlyEmojis ? styles.onlyEmojisText : undefined,
styles.ltr,
style,
styleAsDeleted ? styles.offlineFeedback.deleted : undefined,
styleAsMuted ? styles.colorMuted : undefined,
!DeviceCapabilities.canUseTouchScreen() || !isSmallScreenWidth ? styles.userSelectText : styles.userSelectNone,
]}
>
{convertToLTR(message ?? '')}
</Text>
{fragment?.isEdited && (
<>
<Text
style={[containsOnlyEmojis && styles.onlyEmojisTextLineHeight, styles.userSelectNone]}
dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}}
>
{' '}
</Text>
<Text
fontSize={variables.fontSizeSmall}
color={theme.textSupporting}
style={[styles.editedLabelStyles, styleAsDeleted && styles.offlineFeedback.deleted, style]}
>
{translate('reportActionCompose.edited')}
</Text>
</>

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

We can follow the similar pattern of adding islarge attribute to the emoji tag here,

const htmlContent = containsOnlyEmojis ? Str.replaceAll(htmlWithDeletedTag, '<emoji>', '<emoji islarge>') : htmlWithDeletedTag;

const editedTag = fragment?.isEdited ? `<edited ${styleAsDeleted ? 'deleted' : ''} ${containsOnlyEmojis ? 'islarge' : ''}></edited>` : '';

Then in the edited renderer, apply the emoji only line height if islarge is true.

const isPendingDelete = !!(tnode.attributes.deleted !== undefined);
return (
<Text>
<Text
style={styles.userSelectNone}
dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}}
>
{' '}
</Text>
<Text
// eslint-disable-next-line react/jsx-props-no-spreading
{...defaultRendererProps}
fontSize={variables.fontSizeSmall}
color={theme.textSupporting}
style={[styles.editedLabelStyles, isPendingDelete && styles.offlineFeedback.deleted]}
>
{translate('reportActionCompose.edited')}
</Text>
</Text>
);

const isLarge = !!(tnode.attributes.islarge !== undefined);

<Text style={isLarge && styles.onlyEmojisTextLineHeight}>
    <Text
        style={[styles.userSelectNone, isLarge && styles.onlyEmojisTextLineHeight]}

We need to apply the line height style to the empty space text too because our text component has a default line height value if the font size is normal. (you can see we did this too in the plain text code that I put in the root cause section)

if (!componentStyle.lineHeight && componentStyle.fontSize === variables.fontSizeNormal) {
componentStyle.lineHeight = variables.fontSizeNormalHeight;
}

Or I think the better way is to set a font size for the empty space to be the same as the (edited) text, that is fontSize={variables.fontSizeSmall}.

<Text style={isLarge && styles.onlyEmojisTextLineHeight}>
    <Text
        style={styles.userSelectNone}
        fontSize={variables.fontSizeSmall}

Let me know which one to do!

@sakluger sakluger added the External Added to denote the issue can be worked on by a contributor label Jun 12, 2024
@melvin-bot melvin-bot bot changed the title Android - Chat - Emoji with markdown on edit cut off on top [$250] Android - Chat - Emoji with markdown on edit cut off on top Jun 12, 2024
Copy link

melvin-bot bot commented Jun 12, 2024

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

@melvin-bot melvin-bot bot added Overdue Help Wanted Apply this label when an issue is open to proposals by contributors labels Jun 12, 2024
Copy link

melvin-bot bot commented Jun 12, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Jun 12, 2024
@akinwale
Copy link
Contributor

@bernhardoj's proposal makes sense here.

Or I think the better way is to set a font size for the empty space to be the same as the (edited) text

Let's go with this approach.

🎀👀🎀 C reviewed.

Copy link

melvin-bot bot commented Jun 12, 2024

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

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

melvin-bot bot commented Jun 12, 2024

📣 @akinwale 🎉 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 Jun 12, 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 Jun 13, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @akinwale

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jun 21, 2024
@melvin-bot melvin-bot bot added the Awaiting Payment Auto-added when associated PR is deployed to production label Jun 21, 2024
@melvin-bot melvin-bot bot changed the title [$250] Android - Chat - Emoji with markdown on edit cut off on top [HOLD for payment 2024-06-28] [$250] Android - Chat - Emoji with markdown on edit cut off on top Jun 21, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 21, 2024
Copy link

melvin-bot bot commented Jun 21, 2024

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

Copy link

melvin-bot bot commented Jun 21, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.0-9 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-06-28. 🎊

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

Copy link

melvin-bot bot commented Jun 21, 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:

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

Summarizing payment on this issue:

Contributor: @akinwale $250, paid via Upwork
Contributor : @bernhardoj $250, paid via Upwork

@akinwale could you please complete the BZ checklist?

@akinwale
Copy link
Contributor

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

Not a regression.

  • [@akinwale] Determine if we should create a regression test for this bug.
  • [@akinwale] 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.

Regression Test Steps

  1. Launch Expensify.
  2. Open any report.
  3. Send a message with only emoji (😄).
  4. Edit the previously sent message and wrap the emoji in markdown, eg italics (😄).
  5. Verify that the emoji is not cut off at the top.

Do we agree 👍 or 👎?

@melvin-bot melvin-bot bot added the Overdue label Jul 1, 2024
@sakluger
Copy link
Contributor

sakluger commented Jul 1, 2024

Thanks! I created the GH issue to update regression test steps.

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
Archived in project
Development

No branches or pull requests

5 participants