Skip to content

LHN - When user enters multiline message, first and last line displayed in LHN #33308

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.14
Reproducible in staging?: Y
**Reproducible in production?:**N
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. Go to https://staging.new.expensify.com/
  2. Tap on a chat
  3. Enter a multi line message (eg: select a emoji, tap few times enter key, then enter a text)
  4. Note the chat message in LHN

Expected Result:

When user enters multiline message, only first line must be displayed in LHN

Actual Result:

When user enters multiline message, first and last line both displayed in LHN

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

Bug6319958_1703005643599.multi.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCash
    on Dec 19, 2023
  2. github-actions commented on Dec 19, 2023

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  3. melvin-bot commented on Dec 19, 2023

    @melvin-bot

    Triggered auto assignment to @neil-marcellini (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

  4. bernhardoj commented on Dec 19, 2023

    @bernhardoj
    Contributor

    Proposal

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

    When we send a multiline message, the LHN last message preview shows the new line as whitespace that's why we can see the last line.

    What is the root cause of that problem?

    When we add a new message, we optimistically format the message by only taking the first line of the message.

    const lastCommentText = ReportUtils.formatReportLastMessageText(lastComment?.text ?? '');

    App/src/libs/ReportUtils.ts

    Lines 1185 to 1190 in ab4279b

    function formatReportLastMessageText(lastMessageText: string, isModifiedExpenseMessage = false): string {
    if (isModifiedExpenseMessage) {
    return String(lastMessageText).trim().replace(CONST.REGEX.LINE_BREAK, '').trim();
    }
    return String(lastMessageText).trim().replace(CONST.REGEX.AFTER_FIRST_LINE_BREAK, '').substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH).trim();
    }

    But after the API request is successful, the BE returns a different format of the last message. BE replaces all new line with a whitespace.

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

    If the BE changes is intended (by replacing all new line with whitespace), then we need to update the optimistic logic for the FE too. Otherwise, we need to fix it on the BE.

    replace(CONST.REGEX.LINE_BREAK, ' ')
    

    We would need to update it here too.

    if (messageText) {
    messageText = String(messageText).replace(CONST.REGEX.AFTER_FIRST_LINE_BREAK, '').substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH).trim();
    }

    Or just use ReportUtils.formatReportLastMessageText

  5. ZhenjaHorbach commented on Dec 19, 2023

    @ZhenjaHorbach
    Contributor

    I think we need to wait for this ticket when FE will be updated
    #32497

  6. situchan commented on Dec 19, 2023

    @situchan
    Contributor

    @bernhardoj this is deploy blocker so you mean that regression came from staging backend?

  7. bernhardoj commented on Dec 19, 2023

    @bernhardoj
    Contributor

    @situchan looking at the linked issue by @ZhenjaHorbach, the BE update is intentional #32497 (comment) and the FE update is handled on that issue, so we can close this one.

  8. neil-marcellini commented on Dec 19, 2023

    @neil-marcellini
    Contributor

    Yep, thanks @bernhardoj!

  9. removed
    DeployBlockerCash
    on Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions