-
Notifications
You must be signed in to change notification settings - Fork 135
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
Conversation
@bernhardoj, yeah I think the behavior should be consistent across links and emails |
@rayane-djouah updated |
__tests__/ExpensiMark-HTML-test.js
Outdated
@@ -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 ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Do not replace the emoji with link ' + | |
'Replace the emoji with link ' + |
And the same above
There was a problem hiding this comment.
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)'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const testString = '[😀](www.link.com)'; | |
const testString = | |
'Replace the emoji with email link ' + | |
'[😀](www.link.com)'; |
There was a problem hiding this comment.
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>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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()) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cc @francoisl |
🚀Published to npm in v2.0.43 |
Fixed Issues
$ Expensify/App#44835
Tests
What unit/integration tests cover your change? What autoQA tests cover your change?
Updated unit test.
What tests did you perform that validates your changed worked?
a. Send a link with emoji as text (
[😄 link](google.com)
) to any userb. Verify
😄 link
is rendered as a linkWeb
Desktop
iOS mWeb
iOS
Android mWeb
Android
QA
Same as Test step above