Add category id to webhook post serializer

Add category id to webhook post serializer

diff --git a/app/serializers/web_hook_post_serializer.rb b/app/serializers/web_hook_post_serializer.rb
index 4c5176c..731e6ed 100644
--- a/app/serializers/web_hook_post_serializer.rb
+++ b/app/serializers/web_hook_post_serializer.rb
@@ -15,6 +15,10 @@ class WebHookPostSerializer < PostSerializer
     true
   end
 
+  def include_category_id?
+    true
+  end
+
   %i{
     can_view
     can_edit
diff --git a/spec/serializers/web_hook_post_serializer_spec.rb b/spec/serializers/web_hook_post_serializer_spec.rb
index 4366311..cc1f93c 100644
--- a/spec/serializers/web_hook_post_serializer_spec.rb
+++ b/spec/serializers/web_hook_post_serializer_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe WebHookPostSerializer do
 
   it 'should only include the required keys' do
     count = serialized_for_user(admin).keys.count
-    difference = count - 41
+    difference = count - 42
 
     expect(difference).to eq(0), lambda {
       message = +""
@@ -27,6 +27,10 @@ RSpec.describe WebHookPostSerializer do
     }
   end
 
+  it "includes category_id" do
+    expect(serialized_for_user(admin)[:category_id]).to eq(post.topic.category_id)
+  end
+
   it 'should only include deleted topic title for staffs' do
     topic = post.topic
     PostDestroyer.new(Discourse.system_user, post).destroy

GitHub sha: 0a492829

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/callback-data-shape-category-id-vs-category-slug/153188/4