mirror of
https://github.com/discourse/discourse.git
synced 2025-03-12 17:15:20 +08:00
FIX: Always include custom fields in CategorySerializer
even if it is empty
This commit is contained in:
parent
2349ba3bc4
commit
b8bd031648
@ -102,4 +102,8 @@ class CategorySerializer < BasicCategorySerializer
|
|||||||
def custom_fields
|
def custom_fields
|
||||||
object.custom_fields
|
object.custom_fields
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def include_custom_fields?
|
||||||
|
true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,6 +5,9 @@ describe CategorySerializer do
|
|||||||
let(:category) { Fabricate(:category) }
|
let(:category) { Fabricate(:category) }
|
||||||
|
|
||||||
it "includes custom fields" do
|
it "includes custom fields" do
|
||||||
|
json = described_class.new(category, scope: Guardian.new, root: false).as_json
|
||||||
|
expect(json[:custom_fields]).to be_empty
|
||||||
|
|
||||||
category.custom_fields["enable_marketplace"] = true
|
category.custom_fields["enable_marketplace"] = true
|
||||||
category.save_custom_fields
|
category.save_custom_fields
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user