Updating deleted post through API returns Internal Server Error


(Simon Cossar) #1

Attempting to update a deleted post through the API returns a 500 error. The error is undefined method 'id' for nil:NilClass. It’s coming from web_hook.rb.

The problem is that when publishing with the All Users API key the post update method is calling
post = post.with_deleted if guardian.is_staff?. The deleted post is then being used to trigger a DiscourseEvent.

My reason for wanting to get a better response when a deleted post is updated is so that the WP Discourse plugin can use the response to remove the Discourse metadata it has saved for a post. It’s not safe for the plugin to assume that a 500 response means that the post has been deleted.


(Jeff Atwood) #2

Sure, you can take this and fix the bug… it certainly seems like one.


(Sam Saffron) #8

(Sam Saffron) #9

Fixed per: