Skip to content

[HOLD for payment 2024-01-11] [$500] LHN - When receiving a large message with empty lines, the LHN does not display "..." #32497

Closed

Description

@lanitochka17

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.8-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:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Open New Expensify app
  2. Navigate to any conversation
  3. Send a message containing text and empty lines, for example:
    "Hello

Hi"

Expected Result:

Any message received by the user that does not fit completely into the preview in LHN should be displayed with "..." at the end of the preview

Actual Result:

When receiving a large message with empty lines, the LHN does not display "..."

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

Bug6302049_1701794565234.Recording__844.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bb7a63f85d985319
  • Upwork Job ID: 1732095470234775552
  • Last Price Increase: 2023-12-12

Activity

  1. added
    External
    Daily
    Bug
    on Dec 5, 2023
  2. melvin-bot commented on Dec 5, 2023

    @melvin-bot

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

  3. changed the title [-]LHN - When receiving a large message with empty lines, the LHN does not display "..."[/-] [+][$500] LHN - When receiving a large message with empty lines, the LHN does not display "..."[/+] on Dec 5, 2023
  4. melvin-bot commented on Dec 5, 2023

    @melvin-bot
  5. melvin-bot commented on Dec 5, 2023

    @melvin-bot

    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
  6. added
    Help Wanted
    on Dec 5, 2023
  7. melvin-bot commented on Dec 5, 2023

    @melvin-bot

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

  8. ZhenjaHorbach commented on Dec 5, 2023

    @ZhenjaHorbach
    Contributor

    Proposal

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

    LHN - When receiving a large message with empty lines, the LHN does not display

    What is the root cause of that problem?

    The main problem is that as alt text we use the lastMessage from report which by default truncates all text after a newline

    return String(lastMessageText).trim().replace(CONST.REGEX.AFTER_FIRST_LINE_BREAK, '').substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH).trim();

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

    Since the oldlastMessage values only store half the text, we can use lastMessageHtml instead and then using parser.htmlToText get text and to make the text on one line and remove line breaks, we can use replace(/\n/g, ' ')

    As result

    lastMessageTextFromReport = report ? parser.htmlToText(report.lastMessageHtml).replace(/\n/g, ' ') || '' : '';

    lastMessageTextFromReport = report ? report.lastMessageText || '' : '';

    Plus we need update optimisticReport for lastMessageHTML while we are waiting for the result from the backend since for optimisticReport we use only part of text for lastMessageHTML (or we can pass lastAction.message[0].html instead report.lastMessageHtml in first part )

    lastMessageHtml: lastAction.message[0].html,

    lastMessageHtml: lastCommentText,

    What alternative solutions did you explore? (Optional)

    As alternative
    If we don't want to make changes to OptionsListUtils we can return HTML text from getOptionData

    const item = SidebarUtils.getOptionData(fullReport, reportActions, personalDetails, preferredLocale, policy, parentReportAction);

    And then use parser for text inside OptionRowLHN

    {optionItem.alternateText ? (
    <Text
    style={alternateTextStyle}
    numberOfLines={1}
    accessibilityLabel={translate('accessibilityHints.lastChatMessagePreview')}
    >
    {optionItem.alternateText}
    </Text>
    ) : null}

  9. sakluger commented on Dec 8, 2023

    @sakluger
    Contributor

    @mollfpr what do you think about the one proposal we've received so far?

  10. dukenv0307 commented on Dec 8, 2023

    @dukenv0307
    Contributor

    Proposal

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

    Receiving a large message with empty lines, LHN doesn't display ...

    What is the root cause of that problem?

    We format the last message text to only the text in the first line of text in the last action and BE also has the same approach.
    So if the first line is short text LHN display without ...

    return String(lastMessageText).trim().replace(CONST.REGEX.AFTER_FIRST_LINE_BREAK, '').substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH).trim();

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

    When we format the last message text, we can replace all line breaks with space characters and then substring this text. This is the approach that is used by Messenger of Facebook

    return String(lastMessageText).trim().replace(CONST.REGEX.LINE_BREAK, ' ').substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH).trim();
    

    The back end also needs to use this approach to save the lastMessageText field.

    return String(lastMessageText).trim().replace(CONST.REGEX.AFTER_FIRST_LINE_BREAK, '').substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH).trim();

    What alternative solutions did you explore? (Optional)

    If we don't want to change this in back-end, we can use this approach lastMessageTextFromReport function. But I'd like to fix back-end logic and formatReportLastMessageText function so lastMessageText in report data is synced and we can use this in all places of the App without any more change.

    lastMessageTextFromReport = report ? lodashGet(lastReportAction, 'message[0].text', '').trim().replace(CONST.REGEX.LINE_BREAK, ' ').substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH).trim() || '' : ''; 
    
    

    lastMessageTextFromReport = report ? report.lastMessageText || '' : '';

    Result

    Screen.Recording.2023-12-08.at.16.48.56.mov
  11. 31 remaining items

  12. melvin-bot commented on Jan 4, 2024

    @melvin-bot

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

    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:

    • @mollfpr requires payment (Needs manual offer from BZ)
    • @dukenv0307 requires payment (Needs manual offer from BZ)
  13. melvin-bot commented on Jan 4, 2024

    @melvin-bot

    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.
    • [@sakluger] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  14. added
    Daily
    and removed
    Weekly
    on Jan 11, 2024
  15. melvin-bot commented on Jan 11, 2024

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@sakluger)

    • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1732095470234775552/hired)
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  16. sakluger commented on Jan 11, 2024

    @sakluger
    Contributor

    Sent an offer to @dukenv0307.

    @mollfpr are you still requesting via NewDot, or should I send you an offer via Upwork? Either way, could you please complete the BZ checklist? Thanks!

  17. mollfpr commented on Jan 12, 2024

    @mollfpr
    Contributor

    [@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. This improvement and we do need the BE change to solved this issue.

    [@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 good.

    [@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. Open a chat
    2. Send a message with some lines break, and the first line is short
    3. Verify that in LHN, the last message is displayed with ...
    4. 👍 or 👎

    @sakluger I'll be requesting through NewDot; thank you!

  18. MariaHCD commented on Jan 12, 2024

    @MariaHCD
    Contributor

    @mollfpr for the regression test steps, I'm thinking we should provide some samples to make it more clear what the expected result should be:

    Input:

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
    

    Expected result: The LHN displays the message truncated to 79 characters & with an ellipses ... at the end.

    Screenshot 2024-01-12 at 3 30 30 PM

    Input:

    Lorem Ipsum is simply dummy text 
    
    
    
    
    
    of the printing and typesetting industry. 
    
    
    
    Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. 
    
    
    
    
    
    It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus 
    

    Expected result: The chat in the LHN shows the first line, followed by a space and then a few characters of the second line ending with ...

    Screenshot 2024-01-12 at 3 32 38 PM

    Input:

    Line 1
    
    
    
    
    
    
    Line 2
    
    
    
    
    
    
    Line 3
    

    Expected result: The chat in the LHN shows all three lines of the message separated by a space

    Screenshot 2024-01-12 at 3 31 15 PM

  19. sakluger commented on Jan 13, 2024

    @sakluger
    Contributor

    Thanks @mollfpr, and thanks @MariaHCD for the added suggestion, I agree that including specifics of what to type is helpful in regression tests to guarantee the tests are carried out consistently.

    @dukenv0307 can you please accept the Upwork offer and let me know once you have? Thanks!

  20. JmillsExpensify commented on Jan 14, 2024

    @JmillsExpensify
    Contributor

    $500 payment approved for @mollfpr based on this comment.

  21. dukenv0307 commented on Jan 15, 2024

    @dukenv0307
    Contributor

    @dukenv0307 can you please accept the Upwork offer and let me know once you have? Thanks!

    @sakluger I accepted, thank you!

  22. sakluger commented on Jan 15, 2024

    @sakluger
    Contributor

    Thanks! I've finished paying out the contract, all done here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions