Post created is fired when topic created

Working with the internal event hooks and I noticed, when the topic_created event triggers so does post_created. For the initial topic post, wouldn’t the assumption be that a post was created as well?

Is there a reason why they both would fire at the same time? It seems redundant to have both fire at the same time, especially because you cannot create a topic without an inital post.


DiscourseEvent.on(:topic_created) do |topic|
    puts "New Topic"

DiscourseEvent.on(:post_created) do |post|
   puts "New post"

It is by design. If post_created event skipped in topic creations then the code which only listening post_created events won’t be executed.


Ah that makes sense just seemed odd to me at first glance.