mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 14:03:18 +08:00
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:
parent
bad7c287dd
commit
b98cf565d1
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user