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

Improvements to twitter & facebook handling #6848

Merged
merged 4 commits into from
May 17, 2016

Conversation

ErisDS
Copy link
Member

@ErisDS ErisDS commented May 17, 2016

This PR merges together several changes:

  • updates to the validation for facebook to handle oldschool /page/id urls
  • changing to always store only the unique username / page name portion of twitter & facebook urls
  • adding new utilities to construct the full urls from the usernames
  • updating structured data etc to use the new utilities to output urls where needed
  • providing 2 new helpers for the theme API which also use the new utilities to output urls where needed

All together, these changes should go green in travis!

ErisDS and others added 3 commits May 17, 2016 16:39
refs TryGhost#6534

- this PR assumes that we are now saving usernames only in the database for twitter & facebook
- adds a new social links utility which can generate twitter & facebook urls from the username
- adds a {{twitter_url}} and {{facebook_url}} helper which uses these
- adds a full suite of tests for the helpers & utils
refs TryGhost#6534

- twitter & facebook fields are changing to store usernames only
- use the new social url util to generate urls where necessary
- update tests
closes TryGhost#6826

- refactors the validation of facebook and twitter input field in `general.js` and `user.js` controller
	- Example validations for facebook:
		- `facebook.com/username` will be corrected to the full URL
		- `user` will show error `Your Page name is not a valid Facebook Page name' for `general.js` and `Your Username is not a valid Facebook Username` for `user.js` as the username in facebook has to be at least 5 characters long
		- `twitter.com/username` will be autocorrected to the valid facebook URL incl. the `username`
	- Example validations for twitter:
		- `twitter.com/user_` will be corrected to the full URL
                - `user:99` will show error `Your Username is not a valid Twitter Username`
                - `facebook.com/username` will be autocorrected to the valid twitter URL incl. the `username`
- updates both acceptance tests
- adds further validation for facebook pages in general settings and user. Submitting a url which incl. `/page/` or `/pages/` will now accept any username followed incl. further `/`.
- adds a custom transform `facebook-url-user` which will extract the username (if it's a facebook page, incl. `pages/`) to store only this in the backend
- uses the `twitter-url-user` transform now also for user
@kevinansfield
Copy link
Member

Something is broken here 😢

  1. Add twitter/facebook in settings
  2. Refresh the admin screen
  3. Click into then out of the twitter/facebook fields
  4. Observe that the fields are now empty 😞

no issue
- updates the logic to expect `null` scratch values as the scratch values won't be set until the input value has changed
- adds tests for initial value display and regression tests for the cleared input bug
@kevinansfield
Copy link
Member

🍀 finger's crossed it's all good now!

@ErisDS
Copy link
Member Author

ErisDS commented May 17, 2016

I've tested this and it looks good 👍

@ErisDS ErisDS merged commit 5948277 into TryGhost:master May 17, 2016
@ErisDS ErisDS deleted the twitter-facebook branch May 17, 2016 19:59
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.

3 participants