I’m fixing an issue with events plugin where the events data in the post_custom_field doesn’t get saved if the category is set to require approval for topics.
I reffered to the polls plugin and there it seems that the custom fields are being set on
this is the snippet from polls.
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
on(:approved_post) do |queued_post, created_post|
In my attempt, the custom fields data is available at,
NewPostManager, but the
ReviewableQueuedPost instance in the callback of
:approved_post (which ideally should have the custom field in its payload) doesn’t have it.
NewPostManager.add_handler do |manager|
if manager.args['event'] && NewPostManager.post_needs_approval?(manager) # this condition stands true
manager.args['is_event'] = true
on(:approved_post) do |reviewable, post|
p reviewable.payload['is_event'] #data isn't available here