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

make usermention case insensitive #584

Closed
wants to merge 0 commits into from

Conversation

nikhildewoolkar
Copy link
Contributor

Fixed Issues

Expensify/App#26016

Tests

Open the app
Open any report
Write '@' to trigger mentions
Select any one mention, make any letter of mention as capital and send
Hover on mention to observe that tooltip doesn't display the right display name and avatar
For same mention as step 4 or select different mention and capitalize all letters and send
Observe that now it is not displayed as mention

@nikhildewoolkar nikhildewoolkar requested a review from a team as a code owner October 5, 2023 04:50
@github-actions
Copy link

github-actions bot commented Oct 5, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@cristipaval
Copy link
Contributor

CLA Assistant Lite bot: Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.

I have read the CLA Document and I hereby sign the CLA

You can retrigger this bot by commenting recheck in this Pull Request

@nikhildewoolkar Could you please sign the CLA?

@sobitneupane
Copy link
Contributor

@nikhildewoolkar Bump on this

Copy link
Contributor

@neil-marcellini neil-marcellini left a comment

Choose a reason for hiding this comment

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

Please add automated tests for this case so that people don't change it in the future and accidentally cause a regression.

@neil-marcellini
Copy link
Contributor

The current code change looks good though 👍

@nikhildewoolkar
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@nikhildewoolkar
Copy link
Contributor Author

recheck

@cristipaval
Copy link
Contributor

Please add automated tests for this case so that people don't change it in the future and accidentally cause a regression.

Thanks @nikhildewoolkar! Could you now take care of this comment from @neil-marcellini ?

@nikhildewoolkar
Copy link
Contributor Author

updated pr with testcases

@cristipaval
Copy link
Contributor

@neil-marcellini Could you please review this one again?

cristipaval
cristipaval previously approved these changes Oct 11, 2023
@neil-marcellini
Copy link
Contributor

Yes I will review it today

__tests__/ExpensiMark-HTML-test.js Outdated Show resolved Hide resolved
@nikhildewoolkar
Copy link
Contributor Author

updated the pr with suggested changes.kindly review

replacement: (match) => {
if (!Str.isValidMention(match)) {
return match;
}
return `<mention-user>${match}</mention-user>`;
return `<mention-user>${match.toLowerCase()}</mention-user>`;
Copy link
Contributor

Choose a reason for hiding this comment

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

@nikhildewoolkar Won't this convert the input to lowercase? As discussed in the issue, we don't want to convert the input to lower case. We want to leave it as it is.

Context: Expensify/App#26016 (comment)
Expensify/App#26016 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok yes good catch, thank you. I agree that we don't want to make it lowercase here.

That also makes me think that we should have tests for converting a mention in html back to markdown, with uppercase, lowercase, mixed, etc.

Copy link
Contributor

@neil-marcellini neil-marcellini left a comment

Choose a reason for hiding this comment

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

Sobit pointed out that we don't want to change the case and I agree. Please update that.

replacement: (match) => {
if (!Str.isValidMention(match)) {
return match;
}
return `<mention-user>${match}</mention-user>`;
return `<mention-user>${match.toLowerCase()}</mention-user>`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok yes good catch, thank you. I agree that we don't want to make it lowercase here.

That also makes me think that we should have tests for converting a mention in html back to markdown, with uppercase, lowercase, mixed, etc.

@nikhildewoolkar
Copy link
Contributor Author

updated PR. please review.

Copy link
Member

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

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

LGTM!

@sobitneupane @neil-marcellini btw, what is the process to update the version in App?

Copy link
Contributor

@neil-marcellini neil-marcellini left a comment

Choose a reason for hiding this comment

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

Looking good, but let's also add complete tests please, as I mentioned last time.

we should have tests for converting a mention in html back to markdown, with uppercase, lowercase, mixed, etc.

@nikhildewoolkar
Copy link
Contributor Author

PR Updated

Comment on lines 1405 to 1416

testString = '@[email protected]';
expect(parser.replace('<mention-user>@[email protected]</mention-user>')).toBe(testString);

testString = '@[email protected]';
expect(parser.replace('<mention-user>@[email protected]</mention-user>')).toBe(testString);

testString = '@[email protected]';
expect(parser.replace('<mention-user>@[email protected]</mention-user>')).toBe(testString);

testString = '@[email protected]';
expect(parser.replace('<mention-user>@[email protected]</mention-user>')).toBe(testString);
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good, but I think we should add these tests to __tests__/ExpensiMark-HTMLToText-test.js and __tests__/ExpensiMark-Markdown-test.js.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry that this is dragging on for a while. Please DM me when you make the updates and we can have faster iterations and get this merged today.

@nikhildewoolkar
Copy link
Contributor Author

By mistake, I closed this PR. So made new PR with the changes suggested in earlier chats #591. Kindly Review.

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.

5 participants