Here’s a snippet from polls plugin
on(:approved_post) do |queued_post, created_post|
We need to do the same. Only change is we need to update the custom fields of thetopic of the post with the fields present in the post.
Hence, I need to bring the event data to the
queued_post's payload object.
For that, this is what polls plugin (seems to be) doing
NewPostManager.add_handler(1) do |manager|
post = Post.new(raw: manager.args[:raw])
result = NewPostResult.new(:poll, false)
post.errors.full_messages.each do |message|
result.errors[:base] << message
manager.args["is_poll"] = true
Now, I did the a similar thing. But still, my data doesn’t get set in
The thing is regular posts and under review posts are being saved in different manner.
Core guys have started looking into it and it seems that it is a problem with Discourse itself.