Refactor to remove author.email from API#5159
Merged
sebgie merged 1 commit intoTryGhost:masterfrom Apr 21, 2015
Merged
Conversation
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
7cc43ba to
e26e83d
Compare
14 tasks
Member
Author
|
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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Essentially, this PR gets rid of a TODO in frontend.js, but ends up requiring us to ensure we pass the
contextobject through to thetoJSONobject, 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
optionsto all toJSON calls on posts, tags, and users