Trim `WebHookPostSerializer` further.

This commit is contained in:
Guo Xiang Tan 2018-05-21 10:52:57 +08:00
parent 3ff0074e9d
commit 60e7b13f59
3 changed files with 11 additions and 1 deletions

View File

@ -374,6 +374,10 @@ class PostSerializer < BasicPostSerializer
object.revisions.size > 0
end
def include_hidden_reason_id?
object.hidden
end
private
def topic

View File

@ -12,6 +12,12 @@ class WebHookPostSerializer < PostSerializer
can_delete
can_recover
can_wiki
actions_summary
can_view_edit_history
yours
primary_group_flair_url
primary_group_flair_bg_color
primary_group_flair_color
}.each do |attr|
define_method("include_#{attr}?") do
false

View File

@ -10,7 +10,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 - 34
expect(difference).to eq(0), lambda {
message = ""