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

Refactor to remove author.email from API #5159

Merged
merged 1 commit into from
Apr 21, 2015
Merged

Conversation

ErisDS
Copy link
Member

@ErisDS ErisDS commented Apr 17, 2015

Essentially, this PR gets rid of a TODO in frontend.js, but ends up requiring us to ensure we pass the context object through to the toJSON object, so that it can check whether or not a field should be included. This is potentially useful for doing other post-fetch checks based on permissions in future, but there may be a better way with bookshelf plugins.

Doing this at the toJSON level ensures that the email is correctly removed no matter how the user object is fetched (i.e. if it's from the post API or the user API).

This also fixes a bug whereby the author.email is incorrectly available when on an author page.

Finally this means the email will also be correctly removed when using the get helper.

refs #2330

  • Pass through options to all toJSON calls on posts, tags, and users
  • Use options.context.user to determine whether it's OK to return user.email
  • Remove author.email handling code from frontend.js

refs TryGhost#2330

- Pass through `options` to all toJSON calls on posts, tags, and users
- Use options.context.user to determine whether it's OK to return user.email
- Remove author.email handling code from frontend.js
@ErisDS ErisDS changed the title [WIPRefactor to remove author.email from API [WIP] Refactor to remove author.email from API Apr 17, 2015
@ErisDS ErisDS force-pushed the author-email branch 2 times, most recently from 7cc43ba to e26e83d Compare April 17, 2015 23:27
@ErisDS ErisDS mentioned this pull request Apr 19, 2015
14 tasks
@ErisDS ErisDS changed the title [WIP] Refactor to remove author.email from API Refactor to remove author.email from API Apr 20, 2015
@ErisDS
Copy link
Member Author

ErisDS commented Apr 20, 2015

Removed WIP from this, all of the automated tests are green. Did a bit of manual testing and all seems well.

sebgie added a commit that referenced this pull request Apr 21, 2015
Refactor to remove author.email from API
@sebgie sebgie merged commit 2ed6dae into TryGhost:master Apr 21, 2015
tushdante pushed a commit to tushdante/Ghost that referenced this pull request May 20, 2015
…who invited you

closes TryGhost#5283
- due to the changes with the api call in pr TryGhost#5159 the email address wasn't showing up
- modified the api call to fetch user data to pass the context object to the toJSON object
@ErisDS ErisDS deleted the author-email branch June 22, 2015 18:21
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