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

Ghost post JSON changed breaking comment publish #17

Closed
fuzzmz opened this issue Oct 1, 2014 · 7 comments
Closed

Ghost post JSON changed breaking comment publish #17

fuzzmz opened this issue Oct 1, 2014 · 7 comments

Comments

@fuzzmz
Copy link
Contributor

fuzzmz commented Oct 1, 2014

The JSON reply to /ghost/api/v0.1/posts/:id has changed between v0.4.x and v0.5.x.

The new reply is {posts: [result.toJSON()]} versus the old one which just returned result.toJSON(). This means that the code for parsing the reply (line 154 in /public/lib/embed.js) won't work correctly.

Also note that the actual content returned by the API call has changed, but nothing that breaks the comments plugin (at least so far).

fuzzmz referenced this issue in fuzzmz/nodebb-plugin-blog-comments Oct 7, 2014
reply structure sent starting from Ghost v0.5.x
@rmopl
Copy link

rmopl commented Nov 28, 2014

Integration with Ghost is a really cool feature. It looks great, helps jump-start the forum, you avoid shipping users' data to Disqus.

Are there any plans to fix it? Is it on a backburner until Ghost's API stabilizes?

@fczuardi
Copy link

Why is the ghost api being used at all? Just to get the title and markdown of the post?
Can't we replace this with regular DOM query selectors since the script is already running on a page that has class names for title and content? Or simply get the title only…

@fczuardi
Copy link

What I am trying to say is that the script could fallback to a non-API-dependent version while Ghost doesnt provide public access to some API calls.

@fczuardi
Copy link

the ghost fix we are waiting is TryGhost/Ghost#4181 right? while it doesnt happen here is the super-ugly workaround I am using on embej.js (I've basically removed the ajax call):

https://gist.github.com/fczuardi/72a5103b5c1f0ba87eb3

@fuzzmz
Copy link
Contributor Author

fuzzmz commented Feb 12, 2015

@fczuardi, you are right, the Ghost API is used to get the Title and Markdown of the post (and in the future things like tags and such). The title can be obtained by going through the DOM, but unfortunately the article text wouldn't be that usable due to the lack of markdown tags for formatting.

The idea of falling back to that until TryGhost/Ghost#4181 is indeed a good one.

Also, an alternative to your workaround is to modify the routes exposed by Ghost and make them public as well as this plugin to use the new routes. See this post for my implementation.

@fczuardi
Copy link

yes @fuzzmz, patching the plugin + patching ghost is a workaround that gives better results (we get the markdown), but has the drawback of having to touch 2 projects (if you dont count changing the ghost template a patch in itself), which means remembering to re-patch if any of the two changes… nothing wrong with that, but for me just the title and link is a compromise I can live with until the bug gets fixed :)

@psychobunny
Copy link
Owner

I've just released v0.3.0 of this plugin:

  • Fixed quite a few server crashes (especially when publishing)
  • Compatible with NodeBB 0.6x+ and Ghost 0.5.10
  • Added tags support for Ghost

Sorry for the super delay, I haven't had much chance outside of NodeBB development to dedicate to this plugin until now

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 a pull request may close this issue.

4 participants