Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
2.99k stars 2.5k forks source link

Mark down - #mention in multiline code block is not consistent in expense preview and thread #41580

Closed lanitochka17 closed 1 week ago

lanitochka17 commented 2 weeks ago

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.70-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: N/A Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Send a multiline code block text containing a #mention in the second line
    hello
    #bye
  3. Note that the #mention is in monospace font
  4. Submit an expense containing the same text in Step 2
  5. Note that in 1:1 DM, the #mention is not in monospace font
  6. Go to transaction thread
  7. Note that #mention is in monospace font but highlighted in the description row

Expected Result:

mention in multiline code block should be in monospace font and should not be highlighted in expense preview

Actual Result:

In Step 5, #mention in multiline code block is not in monospace font in expense preview in the main chat In Step 7, #mention in multiline code block is highlighted in description row in transaction thread

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/78819774/33995ccd-d04f-430c-a46e-5d857d2af17e

View all open jobs on GitHub

melvin-bot[bot] commented 2 weeks ago

Triggered auto assignment to @joekaufmanexpensify (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 commented 2 weeks ago

@joekaufmanexpensify 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 commented 2 weeks ago

We think that this bug might be related to #vip-vsp

bernhardoj commented 2 weeks ago

Proposal

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

The room mentioned is rendered as mention inside codeblock in money request description, but not in the chat message.

What is the root cause of that problem?

The regex for room mention currently doesn't prevent to be converted into room mention when inside a code block. When we send a message with a room mention inside a codeblock, you can see it's rendered as a mention. If the room mention doesn't exist, then the BE will return the message without the mention. If the room exists, then the mention stays.

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

We should prevent the text to be converted into room mention if it's inside a codeblock. We can follow the regex from other mention that is by adding

(?!((?:(?!<a).)+)?<\\/a>|[^<]*(<\\/pre>|<\\/code>))

to the end of the regex. This will prevent the room mention to be rendered inside a link, code block, and inline code block.

joekaufmanexpensify commented 1 week ago

going to review this morning

joekaufmanexpensify commented 1 week ago

I can't imagine it's going to be common that many/any customer try and put a multi-line code block as the description for an expense. I'm inclined to say we should do nothing now, and see if any actual customers experience this before deciding to do anything. Closing.

bernhardoj commented 1 week ago

@joekaufmanexpensify the issue also happens when the user sends a multiline code block with a valid room name. I think we should make it consistent with a user/here mention since it doesn't have the issue.

image

Basically, we need to not allow room mention inside a code block.

joekaufmanexpensify commented 1 week ago

Is the example your citing in a regular message, rather than a description of an expense?

bernhardoj commented 1 week ago

Yes, it's a regular message.

joekaufmanexpensify commented 1 week ago

Do we think it'll be common that many/anyone will do that? I agree in an ideal world it'd be consistent, but I'm still not sure it's worth prioritizing this right now.

bernhardoj commented 1 week ago

I'm not sure if it's a common thing to do (putting a "hashtag" inside a code block), but I think it's a common expectation that text inside a code block won't be converted to a markdown.

joekaufmanexpensify commented 1 week ago

I actually can't reproduce this with regular messages on my end at all

image
bernhardoj commented 1 week ago

@joekaufmanexpensify did you send the message in a policy room? Room mention only works in a policy room.

https://github.com/Expensify/App/assets/50919443/06435742-08e3-48a2-b012-48312610cd91

bernhardoj commented 4 days ago

@joekaufmanexpensify have you retested it?

joekaufmanexpensify commented 4 days ago

Yes, I did. I do see it in a workspace room. But only if you do a multi-line code block where the room name is second. If It's first, the multi-line code block works correctly. I'm still not really convinced this is worth prioritizing, or that many/anyone will experience this. I feel like it might be good to wait and see if there is any customer impact before deciding to prioritize this.