Plots2: External links containing an `@` at symbol currently parse as public lab usernames.

Created on 17 Mar 2020  ·  24Comments  ·  Source: publiclab/plots2

Scenario:
When inserting an external link on a public lab post
And the link contains an @
Then it should parse as part of the URL and not a link to a public lab username

Screenshot from @joyofsoy:
Screen Shot 2020-03-17 at 3 47 42 PM

Here's an example link to test from the screenshot above: https://medium.com/@erinargyle/working-during-covid-19-how-to-be-good-at-video-meetings-57f49fdb8dcd

A current workaround is to use a site like bit.ly to obfuscate the links, but we'd ideally fix this. Thanks @joyofsoy for reporting! :tada:

Ruby help wanted ws

Most helpful comment

@emilyashley can I work on this?

All 24 comments

Notes from Jeff:

@jywarren : I think we need to change the @______ pattern matcher to not find the pattern inside of links. The pattern matcher is here: https://github.com/publiclab/plots2/blob/acd5a4910632c8cc80f9fadb54d8cc64c9600519/config/initializers/constants.rb#L2

Here's a demo of the pattern match failing based on Joe's original links; it has to be modified to NOT recognize usernames inside of URLs: https://rubular.com/r/HsxxuTG8zG0zSL
Screen Shot 2020-03-17 at 3 57 45 PM

@emilyashley can I work on this?

@Tlazypanda that would be super, thank you!!!

Hi @Tlazypanda , did you have a chance to try out any changes using this expression editor? https://rubular.com/r/HsxxuTG8zG0zSL Seems like a little game, to try and adjust how the '@names' are recognized on our site but not when there is a '/' on either side.

Hey @ebarry I am so sorry totally forgot about this issue while working on other issues ...is it alright if I take it up after some days since my university examinations are going on :sweat_smile:

Of course!!! Good luck on exams!!!

([^`\w]|^)(?<!\/)\@([\w-]+)\b(?!\/)

Seems to be working correctly.Can you please confirm if this regex is correct or not @ebarry ?

Screenshot from 2020-12-17 23-24-02

@jywarren Can you confirm this ?

I wish i could confirm either way but i'm not familiar with regex, sorry for my delayed response, and THANK YOU for working on this!

Works perfectly! https://rubular.com/r/jfKfgjdqi00qy4

image

This can now be inserted at constants.rb -- it'd make a good first-timers-only issue too!

This has been marked as a good candidate for becoming a first-timers-only issue like these, meaning that it's simple, self-contained, and with some extra formatting, could be a great entry point for a new contributor. If you're familiar enough with this code, please consider reformatting or reposting it as a first-timers-only issue, and then ping @publiclab/reviewers to get it labelled. Or, if this is not your first time, try to solve it yourself!


Thanks for reviewing this @jywarren! Thank you Gaurav Ahlawat for doing

this!

+1 336-269-1539 / @lizbarry http://twitter.com/lizbarry / lizbarry.net

On Tue, Jan 5, 2021 at 4:55 PM Jeffrey Warren notifications@github.com
wrote:

Works perfectly! https://rubular.com/r/jfKfgjdqi00qy4

[image: image]
https://user-images.githubusercontent.com/24359/103704067-a4875580-4f76-11eb-81ae-51ab06863ecb.png

This can now be inserted at constants.rb -- it'd make a good
first-timers-only issue too!

This has been marked as a good candidate for becoming a first-timers-only
issue http://www.firsttimersonly.com like these
https://code.publiclab.org/#r=all, meaning that it's simple,
self-contained, and with some extra formatting, could be a great entry
point for a new contributor. If you're familiar enough with this code,
please consider reformatting or reposting it as a first-timers-only issue
https://publiclab.org/notes/warren/10-31-2016/create-a-welcoming-first-timers-only-issue-to-invite-new-software-contributors,
and then ping @publiclab/reviewers
https://github.com/orgs/publiclab/teams/reviewers to get it labelled.

Or, if this is not your first time, try to solve it yourself!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/7675#issuecomment-754925581,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AABHNH47FTWY45FYH34CQCDSYODDNANCNFSM4LN2YLEA
.

@ebarry Could you please convert it into FTO, so that others can solve it ? Thanks!

great job @gauravahlawat81 I can do that for you...or maybe you would like to try and convert this yourself?...I am happy to help where stuck..what do you think?

Yeah sure, I would like to convert it by myself. How do I do that ?

Should I create a new issue or edit this one ?

Great :tada:, yeah creating a new one would be simpler, when you click on new issue here https://github.com/publiclab/plots2/issues/new/choose select the First timer Only Issue and it will prefill a template...after this line where you have **Update** the file [$FILENAME]($BRANCH_URL) in the `$REPO` repository (press the little pen Icon) and edit the line as shown below. indicate the file that needs to be changed and the changes needed... Give it a title and that should be all

Alright, thanks @cesswairimu , I will give it a try!

@cesswairimu How do I generate the diff ?

Not sure if there is another way of doing it...the way I do it is using the first-timer-bot
So with this approach what you do is navigate to the file that you want to edit in this case I believe is https://github.com/publiclab/plots2/blob/main/config/initializers/constants.rb and click on the edit button(pencil icon), make the changes that are needed, then the text-box below this Create a new branch for this commit and start a pull request edit that and make sure it starts with first-timers- then click commit changes...

after that you should see your issue created here https://github.com/publiclab/plots2/issues/ with author as first-timer-bot
more documentation on this is here if this doesn't make sense

I have created the issue, though I had to use a different approach. Please see if everything is fine there, and if something needs to be changed, do let me know.

The issue is perfect..thanks again

Thank you all!

Very neat workflow

+1 336-269-1539 / @lizbarry http://twitter.com/lizbarry / lizbarry.net

On Fri, Jan 8, 2021 at 4:59 AM Cess notifications@github.com wrote:

Closed #7675 https://github.com/publiclab/plots2/issues/7675.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/7675#event-4183687540, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AABHNH2CH642A3GQR5SCQR3SY3JPFANCNFSM4LN2YLEA
.

Was this page helpful?
0 / 5 - 0 ratings