Rocket.Chat
Rocket.Chat copied to clipboard
feat: Link decoration for single labeled and whitelisted internal hosts.
Proposed changes (including videos or screenshots)
Links like http://server/document were not decorated in the chat even if the user whitelisted the domain name as "server".
It needed to be parsed as a link to get decorated, hence the message-parser required to be modified to adapt to this change.
I traced the point of change to be the grammar.pegjs file, specifically where the domain was verified and then the text was passed to autolink function to get parsed as a 'LINK' and not as a 'PLAIN_TEXT'.
I created a utility function to verify the domain names from the custom whitelist for which the text needed to be parsed as a link and then used that function in the pegjs file to verify the domain name. To check this behaviour, I created a test case also.
Issue(s)
This PR may close #29874
Steps to test or reproduce
Mentioned in the issue tagged above.
Further comments
It was first time for me working on a pegjs file, hence I am not sure about the code quality. Please feel free to reach out if any changes or modification is required.