FIX: makes group_show_serializer#is_group_owner follow standards (#10466)

It should only return if is_group_owner, otherwise the field won't be present in json.
This commit is contained in:
Joffrey JAFFEUX 2020-08-18 18:30:08 +02:00 committed by GitHub
parent bad7c287dd
commit b98cf565d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -12,11 +12,11 @@ class GroupShowSerializer < BasicGroupSerializer
end
def include_is_group_owner?
authenticated?
authenticated? && fetch_group_user&.owner
end
def is_group_owner
fetch_group_user&.owner
true
end
def include_is_group_owner_display?

View File

@ -13,7 +13,7 @@ describe GroupShowSerializer do
it 'should return the right attributes' do
json = GroupShowSerializer.new(group, scope: Guardian.new(user)).as_json
expect(json[:group_show][:is_group_owner]).to eq(false)
expect(json[:group_show][:is_group_owner]).to eq(nil)
expect(json[:group_show][:is_group_user]).to eq(true)
end
end