Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

fixed mention regex to respect dots in usernames - #3800

Merged
mxstbr merged 8 commits into
withspectrum:alphafrom
dan-weaver:bug/mention-regex
Feb 12, 2019
Merged

mxstbr merged 8 commits into
withspectrum:alphafrom
dan-weaver:bug/mention-regex

Conversation

@dan-weaver

@dan-weaver dan-weaver commented Aug 19, 2018

Copy link
Copy Markdown
Contributor

Status

  • WIP
  • Ready for review
  • Needs testing

Deploy after merge (delete what needn't be deployed)

  • desktop

Release notes for users (delete if codebase-only change)

  • Bug fix: mention regexp wasn't honoring . within usernames

Related issues
tangentially related to #3793 #2649

before this fix:
screen shot 2018-08-18 at 7 59 40 pm

after this fix:
screen shot 2018-08-18 at 7 58 52 pm

@mxstbr mxstbr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this tag Hey @mxstbr. as "mxstbr." being the mention? That's what I was trying to avoid with not tagging the dot.

@dan-weaver

dan-weaver commented Aug 20, 2018

Copy link
Copy Markdown
Contributor Author

@mxstbr thanks for pointing that out. I think this fixes it, but I'm not super confident in my regexfoo. This may also become irrelevant depending on some things in #3793 (assuming the mention plugin is used).

screen shot 2018-08-20 at 10 00 22 am

@mxstbr

mxstbr commented Aug 20, 2018

Copy link
Copy Markdown
Contributor

Can you try Hey @dan.weaver... What's up?? I think that'll still break... I'm going to look at that PR today!

@dan-weaver

dan-weaver commented Aug 20, 2018

Copy link
Copy Markdown
Contributor Author

Looks like it still works. I added a test case as well. Didn't mean to open a can of works though! Trying to think of any other edge cases 🤔 . Can revisit when and if that other PR is done maybe.
screen shot 2018-08-20 at 10 47 24 am

@mxstbr mxstbr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ohh, thank you for adding a test case 👍

One last question: do we need the \b?

@dan-weaver

Copy link
Copy Markdown
Contributor Author

No it looks like we do not need the \b! Removed

@mxstbr mxstbr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay one last nitpick I swear: can we also add a test case for the original edge case (username with a dot in it) in combination with the trailing period one? 👼

Thank you!!

@dan-weaver

dan-weaver commented Aug 20, 2018

Copy link
Copy Markdown
Contributor Author

Not a nit pick at all. This is embarrassing 😊. I don't think I've had my recommended dose of coffee yet. The changes to the regex I've introduced allow for other trailing punctuation. I've updated it again to specify allowed characters instead of disallowed. this of course means that _ - won't be allowed as trailing chars in a mention which I think is a good thing? They were before though. Let me know if those should be allowed and I can add them. Also updated the test case.

screen shot 2018-08-20 at 11 26 05 am

@mxstbr mxstbr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this of course means that _ - won't be allowed in the mention which I think is a good thing?

I think we want those? Usernames can include - or _!

@dan-weaver

Copy link
Copy Markdown
Contributor Author

@mxstbr this latest changes still allows them it just doesn't allow them to be the last character of the username. Which I think is normal for usernames, wasn't sure what your rules were though.
screen shot 2018-08-20 at 11 31 16 am

@brianlovin

Copy link
Copy Markdown
Contributor

it just doesn't allow them to be the last character of the username

I believe we allow those characters to be the last character of a username

@mxstbr mxstbr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This LGTM!!!

Sorry for the slow reply @dan-weaver, thanks so much for the contribution 💯

@mxstbr
mxstbr merged commit 7876ffe into withspectrum:alpha Feb 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants