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

Add support for @ prefix on MentionFilter base_url #411

Merged

Conversation

jeremysmithco
Copy link
Contributor

I had a situation where I wanted to use the @ prefix on mention links with the MentionFilter (the way tilde is already supported). Example: /@username.

Currently, if you set the base_url like this: base_url: "/@", then the link would be: /@/username and I don't want the slash between @ and username.

I've updated MentionFilter#link_to_mentioned_user and TeamMentionFilter#link_to_mentioned_team to support this, and added accompanying tests.

Additionally, I noticed that the regex %r{[/~]\z} will match strings like ~~~ and //// and I'm wondering if that's intended? If not, I could change those checks to something like url.ends_with?("/@").

Thanks for this gem! 😊

@gjtorikian
Copy link
Owner

Hey thanks for this! I simplified the regexp, and can put this out in a patch release after I review your other PR.

@gjtorikian gjtorikian force-pushed the mention_filter-base_url-at-prefix branch from 8ad4354 to dbbc46a Compare August 4, 2024 19:21
@gjtorikian gjtorikian merged commit ba6ec7f into gjtorikian:main Aug 4, 2024
3 checks passed
@jeremysmithco jeremysmithco deleted the mention_filter-base_url-at-prefix branch August 4, 2024 19:30
@jeremysmithco
Copy link
Contributor Author

Hey thanks, much appreciated! 😊

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.

2 participants