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:
parent
81a265cecd
commit
1ce6ff0a55
|
@ -11,6 +11,10 @@ class WebHookPostSerializer < PostSerializer
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def include_raw?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
%i{
|
%i{
|
||||||
can_view
|
can_view
|
||||||
can_edit
|
can_edit
|
||||||
|
|
|
@ -12,7 +12,7 @@ RSpec.describe WebHookPostSerializer do
|
||||||
|
|
||||||
it 'should only include the required keys' do
|
it 'should only include the required keys' do
|
||||||
count = serialized_for_user(admin).keys.count
|
count = serialized_for_user(admin).keys.count
|
||||||
difference = count - 39
|
difference = count - 40
|
||||||
|
|
||||||
expect(difference).to eq(0), lambda {
|
expect(difference).to eq(0), lambda {
|
||||||
message = +""
|
message = +""
|
||||||
|
|
Loading…
Reference in New Issue