DEV: Include raw in post webhook serializer

This came in as a request on meta to include the raw field in the post
webhook serializer.

 https://meta.discourse.org/t/-/49045/55?u=blake

 Including this field can prevent needing to make a 2nd API request to
 get the raw field of a post.

 It would be handy down the road if we updated the webhook ui to specify
 fields or arguments that you wanted to be included in the serialized
 data, but most requests I've seen to update the serializers have been
 valid requests that are good to add anyways, so I don't think we have
 reached that point yet.
This commit is contained in:
Blake Erickson 2020-06-10 11:55:03 -06:00
parent 81a265cecd
commit 1ce6ff0a55
2 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,10 @@ class WebHookPostSerializer < PostSerializer
true
end
def include_raw?
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 - 39
difference = count - 40
expect(difference).to eq(0), lambda {
message = +""