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 UrlAttribute concern #844

Merged
merged 5 commits into from Mar 29, 2023
Merged

Conversation

jkostolansky
Copy link
Contributor

This PR introduces UrlAttribute concern to remove http(s)://protocol and custom prefix from URL attributes. It also refactors the existing logic for social profile links (github, ...).

It doesn't add any URL validation because I think it's not necessary at this point. The http(s):// protocol is not required in the submitted data, so even asdf should be valid, because https://asdf is a valid URL.

Resolves #842

Copy link
Owner

@joemasilotti joemasilotti left a comment

Choose a reason for hiding this comment

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

This looks great and works exactly how I'd expect it to!

But I think we need a data migration/backfill to update all the existing records. I think this can be accomplished by saving every developer record. But we also need to make sure not to update updated_at because that is used for the "Recently active" badge.

@jkostolansky
Copy link
Contributor Author

I've added a migration, what do you think? The URL logic is duplicated in the migration, because migrations shouldn't depend on the current application code (that will change in the future).

@joemasilotti
Copy link
Owner

Sorry, I didn't mean we needed an actual Rails migration. You can throw a couple lines of a script in lib/tasks/backfills.rake that I can run as a one-off on Heroku.

Does that make sense?

@jkostolansky
Copy link
Contributor Author

🤦‍♂️ Need to think before typing. Sure, makes sense. Changed.

Copy link
Owner

@joemasilotti joemasilotti left a comment

Choose a reason for hiding this comment

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

Excellent - thank you!

@joemasilotti joemasilotti merged commit 2cd495a into joemasilotti:main Mar 29, 2023
4 checks passed
@jkostolansky jkostolansky deleted the fix-prefix branch March 29, 2023 17:15
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.

Fix duplicated protocol prefix in input fields
2 participants