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

LHN - Message preview doesn't treat new line as space #2965

Closed
isagoico opened this issue May 17, 2021 · 22 comments · Fixed by #3059
Closed

LHN - Message preview doesn't treat new line as space #2965

isagoico opened this issue May 17, 2021 · 22 comments · Fixed by #3059
Assignees
Labels
Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@isagoico
Copy link

isagoico commented May 17, 2021

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


Expected Result:

Message preview should display a space if there is a new line in the message.

Actual Result:

Message preview doesn't treat new line as space

Action Performed:

  1. Navigate to a conversation
  2. Send this message
Cool
Test
Of
New line
  1. Check the message preview in the LHN

Workaround:

No need, visual issue.

Platform:

Where is this issue occurring?

Web ✔️
iOS
Android
Desktop App
Mobile Web

Version Number: 1.0.47-0

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos:

image

Expensify/Expensify Issue URL:

View all open jobs on Upwork


From @puneetlath https://expensify.slack.com/archives/C01GTK53T8Q/p1621222051218200

LHN doesn’t treat new line as a space. Notice how in the LHN image there is no space between “Hello!” and the sentence before it. But in the actual message, it is on its own line. We should treat that new line as a space when showing the text in the LHN.

@isagoico isagoico added the AutoAssignerTriage Auto assign issues for triage to an available triage team member label May 17, 2021
@MelvinBot
Copy link

Triggered auto assignment to @zanyrenney (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@MelvinBot MelvinBot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label May 17, 2021
@isagoico isagoico added AutoAssignerTriage Auto assign issues for triage to an available triage team member Daily KSv2 labels May 17, 2021
@quinthar
Copy link
Contributor

quinthar commented May 18, 2021 via email

@zanyrenney zanyrenney removed their assignment May 19, 2021
@MelvinBot
Copy link

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

@tgolen
Copy link
Contributor

tgolen commented May 19, 2021

Looks like a good contributor issue.

@tgolen tgolen added the External Added to denote the issue can be worked on by a contributor label May 19, 2021
@MelvinBot
Copy link

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

@jliexpensify
Copy link
Contributor

jliexpensify commented May 20, 2021

Can confirm this is happening on v1.0.48-0:

image

Will get this to Upwork.

p.s. Puneet brought up the issue here - https://expensify.slack.com/archives/C01GTK53T8Q/p1621222051218200

@marcaaron
Copy link
Contributor

I thought maybe we could build this into ExpensiMark, but since we just need to convert the HTML into plain text + converts line breaks into spaces it can probably be a simple utility function like this but swap out the \n for a single space character?

@jliexpensify
Copy link
Contributor

Posted to upwork: https://www.upwork.com/jobs/~01335a9f088d223b91

@parasharrajat
Copy link
Member

Here is my proposal.

  1. As Marc said, its fairly simple. We need to replace <br> tags with spaces before converting the HTML markup to text for lastMessageText in report object creation.
    https://github.com/Expensify/Expensify.cash/blob/ff61c1aaf2309ed4fcaf1264ff149acbeb9bfa9b/src/libs/actions/Report.js#L157
    TO
 const lastMessageText = lodashGet(lastReportAction, ['message', 'html'], '').replace(/(<(br[^>]*)>)/gi, ' ').replace(/(<([^>]+)>)/gi, '');

will just do the trick. This lastMessageText is further used to create Option for LHN.

.

@pranshuchittora
Copy link
Contributor

This is very much related to #2847


Proposal 📄

Message preview should display a space if there is a new line in the message.

Investigation 🕵🏻‍♂️

#2847

Approach 👨🏼‍💻

File of concern : Report.js and expensify-common

Best Practices 💃🏼

  • No hard-coded regexes
  • No inline styling
  • Follow React Native best practices

Testing Strategy 🧪

  • Unit tests for the underlying modules

Expected Delivery Time 📦

Approx 1 week.

Previous Experience 🙅🏼‍♂️

@marcaaron
Copy link
Contributor

That solution looks good @parasharrajat 👍

@marcaaron
Copy link
Contributor

I'll let @tgolen weigh in though as he is assigned to the PR. I think this is something that would happen in the server eventually if we move to reduce processing logic for API data in the client.

@parasharrajat
Copy link
Member

I think this is something that would happen in the server eventually if we move to reduce processing logic for API data in the client.

Then it makes sense

@tgolen
Copy link
Contributor

tgolen commented May 20, 2021

Yep, I think it's OK for now. That logic isn't going anywhere today. If/when it's moved to the server-side then this replacement will come along with the logic.

@parasharrajat
Copy link
Member

@tgolen Are you giving me a 🟢 signal? PR is one-click away?

@tgolen
Copy link
Contributor

tgolen commented May 20, 2021

Yep! 🟢 Click away on your PR!

@jliexpensify
Copy link
Contributor

Thanks @tgolen - I'll go ahead and hire @parasharrajat

@jliexpensify
Copy link
Contributor

Looks like PR is blocked atm, will check again later.

@Beamanator Beamanator removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label May 25, 2021
@jliexpensify
Copy link
Contributor

PR approved and deployed 6 hours ago

@parasharrajat
Copy link
Member

@jliexpensify which PR? mine is still open.

@jliexpensify
Copy link
Contributor

Sorry for the confusion @parasharrajat - I was referring to this one: https://github.com/Expensify/Web-Expensify/pull/31071

It looks like that PR has been deployed, and should have a flow-on effect for your PR to be unblocked soon.

@jliexpensify
Copy link
Contributor

Contributor paid!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants