PR is ready - https://github.com/discourse/discourse/pull/10632
Once merged and deployed you will be able to use it like:
create_posts(pms, total: pms_count, offset: 0) do |pm|
...
p[:topic_opts][:participant_count] = target_usernames.count
...
end
It has to be under [:topic_opts]
because create_posts
method is evaluating post_creator
which triggers topic_creator
https://github.com/discourse/discourse/blob/master/lib/post_creator.rb#L56