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-06-07] [$1000] The horizontal line (for deleted message) is not in the center for the text 'edited' but is center for the 'chat messages' on web chrome (offline mode) #17181

Closed
1 of 6 tasks
kavimuru opened this issue Apr 8, 2023 · 44 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

@kavimuru
Copy link

kavimuru commented Apr 8, 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 web chrome (online mode)
  2. Go to any chat
  3. Send a text message
  4. Edit the message
  5. Click on save
  6. Now turn off your wifi or click on force offline from the preference page
  7. Now delete the message
  8. Notice that the horizontal line for the text 'edited' is not at the center unlike other chat messages
  9. But if you follow the same steps on android , you'll see the horizontal line for the text 'edited' at the center only

Expected Result:
The horizontal line for the edited text should be at the center for the word 'edited' in a similar how android shows it

Actual Result:

The horizontal line for the word 'edited' is not at the center unlike android

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.97-2
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
android

error-2023-04-07_15.48.05.mp4

Expensify/Expensify Issue URL:
Issue reported by: @priya-zha
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1680862318324249

View all open jobs on GitHub

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

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

@MelvinBot
Copy link

MelvinBot commented Apr 8, 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

@melvin-bot melvin-bot bot added the Overdue label Apr 10, 2023
@JmillsExpensify JmillsExpensify self-assigned this Apr 10, 2023
@JmillsExpensify
Copy link

Assigning myself since I was also pulled into the linked Slack convo.

@melvin-bot melvin-bot bot removed the Overdue label Apr 10, 2023
@JmillsExpensify
Copy link

I'm able to reproduce the issue, and while a small visual issue, let's see if the community has ideas on how we can fix this. If we find a great root cause that's fixable we should do something.

Screenshot 2023-04-10 at 11 40 12

@JmillsExpensify JmillsExpensify added the External Added to denote the issue can be worked on by a contributor label Apr 10, 2023
@melvin-bot melvin-bot bot changed the title The horizontal line (for deleted message) is not in the center for the text 'edited' but is center for the 'chat messages' on web chrome (offline mode) [$1000] The horizontal line (for deleted message) is not in the center for the text 'edited' but is center for the 'chat messages' on web chrome (offline mode) Apr 10, 2023
@MelvinBot
Copy link

Job added to Upwork: https://www.upwork.com/jobs/~0118d19fc456de16df

@MelvinBot
Copy link

Current assignee @JmillsExpensify 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 - @sobitneupane (External)

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

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

@pubudu-ranasinghe
Copy link
Contributor

pubudu-ranasinghe commented Apr 10, 2023

Proposal

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

What is the root cause of that problem?

If we inspect this in the browser we can see the following elements and styles that render the message and edited label.

image

We have a div with larger text and line-through applied which displays the message. Inside it there's a span with smaller text which displays edited label. As line-through is applied to the outer div, the browser tries to render the line on the entire block. But because the font sizes are different, the line is not properly aligned. (AFAIK css spec does not have instructions on how to handle line-through with varying font sizes)

This behavior is a common issue and can be reproduced outside of Expensify. We can fix this by making the inner smaller text to be a separate block and apply line-through to that separately.

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

Following is the component that renders the message and edited label.

<Text
family="EMOJI_TEXT_FONT"
selectable={!DeviceCapabilities.canUseTouchScreen() || !props.isSmallScreenWidth}
style={[EmojiUtils.containsOnlyEmojis(text) ? styles.onlyEmojisText : undefined, styles.ltr, ...props.style]}
>
{StyleUtils.convertToLTR(Str.htmlDecode(text))}
{props.fragment.isEdited && (
<Text
fontSize={variables.fontSizeSmall}
color={themeColors.textSupporting}
>
{` ${props.translate('reportActionCompose.edited')}`}
</Text>
)}
</Text>

We can make the Text compoent in L133 to have styles inline-block and also include the line-through. To do that we just need to update the styles as follows in L136

style={[...props.style, {display: 'inline-block'}]}

Handling Markdown

As pointed out by @sobitneupane the above solution alone doesn't address markdown comments. They have the same root cause described above but is rendered separately. So we need to add a fix there as well.

Markdown is rendered by following lines of code

if (!differByLineBreaksOnly) {
const isPendingDelete = props.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && props.network.isOffline;
const editedTag = props.fragment.isEdited ? '<edited></edited>' : '';
const htmlContent = applyStrikethrough(html + editedTag, isPendingDelete);
return (
<RenderHTML
html={props.source === 'email'
? `<email-comment>${htmlContent}</email-comment>`
: `<comment>${htmlContent}</comment>`}
/>
);
}

This renders a custom <edited> element defined in src/components/HTMLEngineProvider/HTMLRenderers/EditedRenderer.js. We can add the same styles inline-block and line-through mentioned above to fix this. But this needs to be added under the condition of app being offline and has pending delete. Since there's no direct way to pass a prop into the EditedRenderer we can use an attribute to pass this information from the ReportActionItemFragment

This is how we can pass this attribute in ReportActionItemFragment L114

const editedTag = props.fragment.isEdited ? `<edited ${isPendingDelete ? 'deleted="true"' : ''}></edited>` : '';

EditedRenderer needs to be updated as follows to read this attribute and apply the styles

// Component Code
const isPendingDelete = !!props.tnode.attributes.deleted;
// component jsx
style={isPendingDelete ? [styles.offlineFeedback.deleted, { display: 'inline-block'}] : undefined}

These changes will not have any impact on the web because span is already inline and there's no visual difference between inline and inline-block. Also it will not have any impact on native apps as RN does not support inline-block and so will be ignored. And yes, this works fine with edited single emoji.

Before
image
image
image

After
image
image
image

What alternative solutions did you explore? (Optional)

Setting the strike through using a pseudo element rather than browser native strike through was another option. This would give greater flexibility in positioning but I'd prefer to use browser features as much as possible.

@MelvinBot
Copy link

📣 @pubudu-ranasinghe! 📣

Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.

Screen Shot 2022-11-16 at 4 42 54 PM

Format:

Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@pubudu-ranasinghe
Copy link
Contributor

Contributor details
Your Expensify account email: pubudutr@gmail.com
Upwork Profile Link: upwork.com/freelancers/~019eaf0e2e67ff1536

@MelvinBot
Copy link

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@sobitneupane
Copy link
Contributor

Thanks for the proposal @pubudu-ranasinghe

Can you please add more explanation in "What is the root cause of that problem?" section. Please make use of permalink to link the places where the issue exists.

Can you please add more details in "What changes do you think we should make in order to solve the problem?" section as well. Please do include how you are going to achieve the suggested change. Also please let us know how will it impact native apps. Have you tested your solution with edited single emoji?

@pubudu-ranasinghe
Copy link
Contributor

Proposal

Updated

@sobitneupane

@sobitneupane
Copy link
Contributor

@pubudu-ranasinghe Thanks for the update.

Your proposal won't solve the issue for all the cases. It won't work in case of markdowns. Try your solution with inline codeblock (`abc`).

@pubudu-ranasinghe
Copy link
Contributor

@sobitneupane yes you are correct. This solution alone was not handling html comments. I've updated the original proposal to include a fix for this.

Proposal

Updated

@melvin-bot melvin-bot bot added the Overdue label Apr 14, 2023
@trjExpensify
Copy link
Contributor

@sobitneupane thoughts?

@melvin-bot melvin-bot bot removed the Overdue label Apr 14, 2023
@parasharrajat
Copy link
Member

To be clear on this, is this issue caused by #17704? @sobitneupane

@sobitneupane
Copy link
Contributor

No, it is not. We were going to make use of changes made by #17704. But looks like it is reverted.

@sobitneupane
Copy link
Contributor

Waiting for #18523 PR to merge before proceeding with our PR as we will be using the change introduced in former PR.

@melvin-bot
Copy link

melvin-bot bot commented May 19, 2023

@JmillsExpensify, @pubudu-ranasinghe, @trjExpensify, @NikkiWines, @sobitneupane Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot
Copy link

melvin-bot bot commented May 23, 2023

@JmillsExpensify, @pubudu-ranasinghe, @trjExpensify, @NikkiWines, @sobitneupane Still overdue 6 days?! Let's take care of this!

@sobitneupane
Copy link
Contributor

The associated PR has now merged to main. We will be continuing with our PR.

@trjExpensify
Copy link
Contributor

Dope!

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels May 31, 2023
@melvin-bot melvin-bot bot changed the title [$1000] The horizontal line (for deleted message) is not in the center for the text 'edited' but is center for the 'chat messages' on web chrome (offline mode) [HOLD for payment 2023-06-07] [$1000] The horizontal line (for deleted message) is not in the center for the text 'edited' but is center for the 'chat messages' on web chrome (offline mode) May 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 31, 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 May 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 31, 2023

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

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

@melvin-bot
Copy link

melvin-bot bot commented May 31, 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:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
  • [@sobitneupane] 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:
  • [@sobitneupane] 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:
  • [@sobitneupane] Determine if we should create a regression test for this bug.
  • [@sobitneupane] 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 / @trjExpensify] 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 6, 2023
@trjExpensify
Copy link
Contributor

👋 @sobitneupane can you run through the checklist please so we can move on with processing payments? Thanks!

@sobitneupane
Copy link
Contributor

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:

I tried to go back to few commits to find the exact PR which introduced the issue. But could not point to the exact PR Looks like it was present from the very beginning when edited label was introduced in this PR.

@sobitneupane
Copy link
Contributor

Regression Test Proposal

  1. Open any chat
  2. Send few messages like normal text, emoji, and markdown
  3. Edit the messages
  4. Disable your network or force offline from preferences
  5. Delete the edited messages
  6. Verify that the line through in edited label is aligned properly for all message types

Do we agree 👍 or 👎

@trjExpensify
Copy link
Contributor

I tried to go back to few commits to find the exact PR which introduced the issue. But could not point to the exact PR Looks like it was present from the very beginning when edited label was introduced in #2320.

Cool, fair enough. We comment there then! :)

As for the regression test, we have this one for editing a comment. We could pop it in the offline section. That said, I'd love to offer more direction than just "aligned properly", because who knows if the tester knows what's proper or not. Center aligned? What do you think?

Online

  1. Navigate a conversation (with another user you have access to) in the main testing device
  2. Hover over an owned message (Web/Desktop) / Tap and hold (Mobile) to view the action menu
  3. Click/Tap on the Pencil icon to activate the edit message box
  4. Edit the message to "0" and save the changes
  5. Verify the edited message is still displayed in the conversation viewport (it should not scroll out of view)
  6. Verify the message is displaying the new text, has a "(edited)" status in the conversation history and that the text is not grayed out
  7. Send a message that includes a hyperlink i.e google.com
  8. Edit the message with the hyperlink (do not modify the link) and save the changes
  9. Verify the link is still hyperlinked in the modified message
  10. Now edit the domain part of the link, while keeping the text the same but changing the capitalization of the domain letters i.e google.com
  11. Verify the link is still hyperlinked in the modified message and the domain part maintains its original capitalization
  12. Log in as the other user in the conversation
  13. Verify the edited message is displaying the new text and has a "(edited)" status in the conversation history

Offline

  1. Disable the internet connection in the main testing device
  2. Hover over an owned message (Web/Desktop) / Tap and hold (Mobile) to view the action menu
  3. Click/Tap on the Pencil icon to activate the edit message box
  4. Verify you're able to edit the message while there's no internet connection
  5. Edit the message to "0" and save the changes
  6. Verify the comment text is updated it's greyed out indicating it's pending
    7. Verify that the line through in edited label is aligned properly
  7. Click/tap the pencil icon again
  8. Edit the message to something new
  9. Verify the “save changes” button is enabled, hit the button
  10. Verify the comment text is updated it's greyed out indicating it's pending
  11. Refresh the page or force-kill and relaunch the app
  12. Enable the internet connection in the device - in web you might need to refresh the page after going back online
  13. Verify the comment is not be grayed out anymore indicating it was updated successfully

@melvin-bot melvin-bot bot added the Overdue label Jun 12, 2023
@trjExpensify
Copy link
Contributor

Bump on this @sobitneupane:

That said, I'd love to offer more direction than just "aligned properly", because who knows if the tester knows what's proper or not. Center aligned? What do you think?

@melvin-bot melvin-bot bot removed the Overdue label Jun 12, 2023
@sobitneupane
Copy link
Contributor

Yup. Center aligned will make it clear.

As for the regression test, we have this one for editing a comment. We could pop it in the offline section.

I don't think we can add it in the section you mentioned above. We need to delete the message after editing in offline.

@trjExpensify
Copy link
Contributor

Ah yeah fair, okay.. I'll run it by applause. It could go in the delete offline tests perhaps. Issue created here.

Okay, let's proceed with the payments. I've sent offers for:

$1,000 to @sobitneupane for C+
$1,000 to @pubudu-ranasinghe for the fix
$250 to @priya-zha for the bug report

@trjExpensify
Copy link
Contributor

@sobitneupane paid!

@trjExpensify
Copy link
Contributor

@priya-zha paid!

@trjExpensify
Copy link
Contributor

@pubudu-ranasinghe paid! Closing, thanks 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
Projects
None yet
Development

No branches or pull requests

8 participants