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

Allow emoji as link text #749

Merged
merged 4 commits into from
Jul 11, 2024

Conversation

bernhardoj
Copy link
Contributor

Fixed Issues

$ Expensify/App#44835

Tests

  1. What unit/integration tests cover your change? What autoQA tests cover your change?
    Updated unit test.

  2. What tests did you perform that validates your changed worked?
    a. Send a link with emoji as text ([😄 link](google.com)) to any user
    b. Verify 😄 link is rendered as a link

Web
Screenshot 2024-07-11 at 12 07 30

Desktop
image

iOS mWeb
image

iOS
image

Android mWeb
image

Android
image

QA

  1. What does QA need to do to validate your changes?
  2. What areas to they need to test for regressions?
    Same as Test step above

@bernhardoj bernhardoj requested a review from a team as a code owner July 11, 2024 04:22
@melvin-bot melvin-bot bot requested review from grgia and removed request for a team July 11, 2024 04:22
@bernhardoj
Copy link
Contributor Author

bernhardoj commented Jul 11, 2024

This PR only covers link. Do we also want to update it for email?

(left: link, right: email)
image

@rayane-djouah
Copy link

@bernhardoj, yeah I think the behavior should be consistent across links and emails

@bernhardoj
Copy link
Contributor Author

@rayane-djouah updated

@@ -304,12 +304,12 @@ test('Test markdown replacement for emojis with emails', () => {
'[😄 [email protected] ]([email protected]) ';
const result =
'Do not replace the emoji with link ' +

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'Do not replace the emoji with link ' +
'Replace the emoji with link ' +

And the same above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -1200,7 +1200,7 @@ test('Test for link with no content', () => {

test('Test for link with emoji', () => {
const testString = '[😀](www.link.com)';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const testString = '[😀](www.link.com)';
const testString =
'Replace the emoji with email link ' +
'[😀](www.link.com)';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as comment

@@ -1200,7 +1200,7 @@ test('Test for link with no content', () => {

test('Test for link with emoji', () => {
const testString = '[😀](www.link.com)';
const resultString = '[<emoji>😀</emoji>](<a href="https://www.link.com" target="_blank" rel="noreferrer noopener">www.link.com</a>)';
const resultString = '<a href="https://www.link.com" target="_blank" rel="noreferrer noopener"><emoji>😀</emoji></a>';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const resultString = '<a href="https://www.link.com" target="_blank" rel="noreferrer noopener"><emoji>😀</emoji></a>';
const resultString =
'Replace the emoji with email link ' +
'<a href="https://www.link.com" target="_blank" rel="noreferrer noopener"><emoji>😀</emoji></a>';

@@ -173,7 +173,7 @@ export default class ExpensiMark {
return this.modifyTextForEmailLinks(regex, textToProcess, replacement as ReplacementFn, shouldKeepRawInput);
},
replacement: (_extras, match, g1, g2) => {
if (g1.match(Constants.CONST.REG_EXP.EMOJIS) || !g1.trim()) {
Copy link

@rayane-djouah rayane-djouah Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove CONST.REG_EXP.EMOJIS from constants file as it is not used anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link

@rayane-djouah rayane-djouah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rayane-djouah
Copy link

cc @francoisl

@francoisl francoisl merged commit f914648 into Expensify:main Jul 11, 2024
6 checks passed
Copy link

🚀Published to npm in v2.0.43

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