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

fix(message-parser): Relative URL being displayed as plain text #736

Merged
merged 9 commits into from
Jun 23, 2022

Conversation

hugocostadev
Copy link
Contributor

Proposed changes (including videos or screenshots)

Fixed Relative URLs (without http:// or https://) being displayed as plain text

I also fix this scenario: Links with just one slash were not parsed as link too.

Problems:
image

Issue(s)

Further comments

Steps to reproduce:

  1. Log in to the rocket.chat
  2. Go into the My account/preferences/global Enable New Message Template
  3. Send a message in some DM/Channel/Team/Discussion
  4. Content examples: [www.uol.com](http://www.uol.com/) and [meet.google.com/cea-rxwu-qmb](http://meet.google.com/cea-rxwu-qmb)

Actual result:
The messages were sent without being displayed as a link

Expected result:
The messages should be displayed as a link:

@hugocostadev hugocostadev requested a review from tassoevan June 14, 2022 13:32
@hugocostadev
Copy link
Contributor Author

Benchmark compared with develop branch:

image

Markdown used for the benchmark:

# Heading 1

**Paragraph text**: **Bold** Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales, enim et facilisis commodo, est augue venenatis ligula, in convallis erat felis nec nisi. In eleifend ligula a nunc efficitur, ut finibus enim fringilla. 

## Heading 2

_Italict Text_: _Italict_ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales, enim et facilisis commodo, est augue venenatis ligula, in convallis erat felis nec nisi. In eleifend ligula a nunc efficitur, ut finibus enim fringilla. 

### Heading 3 - Lists, Links and elements

**Unordered List**

- List Item 1
- List Item 2
- List Item 3
- List Item 4

**Ordered List**

1. List Item
2. List Item
3. List Item
4. List Item


> Quote test: **Bold** _Italic_ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales, enim et facilisis commodo, est augue venenatis ligula, in convallis erat felis nec nisi. In eleifend ligula a nunc efficitur, ut finibus enim fringilla.


**Links:**
rocket.chat

google.com

www.google.com

open.rocket.chat

[Google](google.com)

[Rocket.Chat](rocket.chat)

https://desk.rocket.chat/support/rocketchat/ShowHomePage.do#Cases/dv/413244000073043351

<https://desk.rocket.chat/support/rocketchat/ShowHomePage.do#Cases/dv/413244000073043351|Rocket.Chat Link Test>

[Rocket.Chat Link Test](https://desk.rocket.chat/support/rocketchat/ShowHomePage.do#Cases/dv/413244000073043351)

[**Rocket.Chat Link Test**](https://desk.rocket.chat/support/rocketchat/ShowHomePage.do#Cases/dv/413244000073043351)

[~~Rocket.Chat Link Test~~](https://desk.rocket.chat/support/rocketchat/ShowHomePage.do#Cases/dv/413244000073043351)

[__Rocket.Chat Link Test__](https://desk.rocket.chat/support/rocketchat/ShowHomePage.do#Cases/dv/413244000073043351)

[__**~~Rocket.Chat Link Test~~**__](https://desk.rocket.chat/support/rocketchat/ShowHomePage.do#Cases/dv/413244000073043351)


[email protected]

+55991991997

# Images

![Image one](https://assets-global.website-files.com/611a19b9853b7414a0f6b3f6/62330c94833bb061e29ff1dc_in-app-chat-messaging-p-800.png)


# Code blocks

`Inline code`


```typescript
const applyMarkdownIfRequires = (
	list: MessageAttachmentDefault['mrkdwn_in'] = ['text', 'pretext'],
	key: MarkdownFields,
	text: string,
	variant: 'inline' | 'inlineWithoutBreaks' | 'document' = 'inline',
): ReactNode => (list?.includes(key) ? <MarkdownText parseEmoji variant={variant} content={text} /> : text);```

# Unicode Emojis

😀

😀💅💪🧠

🚀⏰🕰

# ASCII Emojis

:) :( :D :X

# Bult in Emojis

:smile: :rocket: :eyes: :success-kid: 

# KaTeX

Easy as \\(E = mc^2\\), right?

\\[
	\\f\\relax{x} = \\int_{-\\infty}^\\infty
	\\f\\hat\\xi\\,e^{2 \\pi i \\xi x}
	\\,d\\xi
\\]

@tassoevan tassoevan merged commit 3ccd090 into develop Jun 23, 2022
@tassoevan tassoevan deleted the fix/relativeURL branch June 23, 2022 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants