Add category id to webhook post serializer

This commit is contained in:
Robin Ward 2020-09-02 10:42:51 -04:00
parent c6e336b519
commit 0a492829ea
2 changed files with 9 additions and 1 deletions

View File

@ -15,6 +15,10 @@ class WebHookPostSerializer < PostSerializer
true
end
def include_category_id?
true
end
%i{
can_view
can_edit

View File

@ -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