-
-
Notifications
You must be signed in to change notification settings - Fork 729
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
Fix for instagram links #2849
Fix for instagram links #2849
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
welcome to OFN @albarnaz
Thanks for your PR!
EDIT: actually I should say Obrigado ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on the placeholders and the migration. I still think it would be good to sanitise the user input and extract the handle if the user pastes the URL. That can be done in a separate pull request though.
class UpdateInstagramData < ActiveRecord::Migration | ||
def change | ||
enterprises = Enterprise.where("instagram like ?", "%instagram.com%") | ||
enterprises.each do |e| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should rather use find_each here IMO. This can potentially be a large list of enterprises.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I agree with it. I will make this change.
Welcome aboard @albarnaz ! If you have any questions feel free to ask on the dev channel of our Slack team. |
Conflicts. Rebase needed? @albarnaz |
e1db89b
to
94c2c41
Compare
Can whoever stages this do a rebase beforehand perhaps? Not sure if you're still active on here @albarnaz? |
@daniellemoorhead I already made a rebase, but I`m not understanding why it failed |
This should do the job |
Or even |
94c2c41
to
f0a47be
Compare
what we agreed with @RachL and @Matt-Yorkley here is that we want to test the migration. I'll can do this but probably next week only. |
Staged on https://staging.openfoodnetwork.org.au/. |
@mkllnk do you know which data were broken before? (see Luis' post above) |
@maikel I've just had a look and from what I can see, now that the PR is staged it's correctly turning https://www.instagram.com/bravefoods/ into @bravefoods . However as Rachel said, should we check also that existing twitter links in the longhand format are getting fixed? There's very little data on staging, so I cant be sure that any of the profiles were previously in the longhand. Perhaps we create some profile with longhand links and then restage the PR? Or another idea? |
Okay, Sally and I are trying out this new feature of the Australian staging server. When master code is on staging, the database is not reset. It's used as new baseline. We can use that here:
These Instagram links are probably a good example of test data we don't need to specify in the code as developers. @sauloperez Would you agree? |
Testing Notes #2859 has been merged, and now the form will convert any new http or www. instagram links into @happyfarm format. This format leads to badges on profiles that are broken. Also, after this PR, now if a profile has their instagram link in the correct format "happyfarm", they'll get an error message when they try to save anything in their Enterprise Settings. I've tested this PR and it's doing what it intends to do - any pre-existing instagram links in the http or www format are converted into @happyfarm links. However, links must be in happyfarm format, not @happyfarm format to work. So what do we need to do?
Testing notes (nothing not described above) |
Hey @albarnaz 👋 This time of year is a busy one, so totally understand if time got away from you. Let us know if you're able to proceed with this or if we should close it for now and let someone else pick up where you left off 😄 |
Hi @daniellemoorhead |
7470fb2
to
36b564f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good. This is ready for testing again.
I ran the migration against the Australian and French production data. It does improve the data, but there are more unhandled cases. This is the conversion on French data:
https://www.instagram.com/conciergerie_de_quartier/ => conciergerie_de_quartier
https://www.instagram.com/conciergerie_de_quartier/ => conciergerie_de_quartier
https://www.instagram.com/geoffrey_martin_74 => geoffrey_martin_74
https://www.instagram.com/clac_conserverie/ => clac_conserverie
https://www.instagram.com/paradisesuperfoods/ => paradisesuperfoods
https://www.instagram.com/ => www.instagram.com
https://www.instagram.com/paradisesuperfoods/ => paradisesuperfoods
https://www.instagram.com/la_panetiere_des_hameaux/ => la_panetiere_des_hameaux
https://www.instagram.com/la_panetiere_des_hameaux/ => la_panetiere_des_hameaux
https://instagram.com/https%3A%2F%2Fwww.instagram.com%2Forangesbio%2F%3Fhl%3Des?fbclid=IwAR35hFjCShjbsS9dL4E914o8OGoPwep_0_m0F0wmulmmHmE4PRlYr04KsZc => https%3A%2F%2Fwww.instagram.com%2Forangesbio%2F%3Fhl%3Des?fbclid=IwAR35hFjCShjbsS9dL4E914o8OGoPwep_0_m0F0wmulmmHmE4PRlYr04KsZc
We still need proper validation for this field.
The commit history contains a few detours now and should be squashed.
Deploying on UK staging |
Alright, didn't forgot front office this time :) As I understand migration has been tested, right @mkllnk ? But indeed we don't have a validation on this field. But in the meantime, new user have now a correct placeholder, which should prevent errors for them. https://docs.google.com/document/d/1ArkpTlOG94yKE8eucDs1RP476XKxBrg6EowF-KV2ubw/edit# So I'm moving this to ready to go, and will open another issue for the validation part. |
@mkllnk do you still want these commits to be squashed? Let's wait for him to ack before merging it. |
@sauloperez I will squash the commits in just one. |
Yes, we can squash it through Github as well, by selecting it on the merge button. |
Issue: #1760
Problem
There is no suggestion in the Instagram empty field in enterprise profile setup menu. Some users copy-paste the full URL on their page. That doesn't work because what is expected is only their Instagram user pseudo.
FIX
Add a suggestion/model in the empty field that guides the user so that he enter the Instagram info at the expected format (as it is done for Twitter for instance).
Add migration to fix the wrong links already inputted, from "http://instagram.com/myUser" to "@myUser"