FIX: Missing Group#bio_raw attribute for group owners.

https://meta.discourse.org/t/group-description-does-not-load-in-editor-for-owners-who-are-not-staff/85345
This commit is contained in:
Guo Xiang Tan 2018-04-17 15:56:55 +08:00
parent 45cfb61af1
commit 64a45b0980
2 changed files with 21 additions and 1 deletions

View File

@ -47,7 +47,7 @@ class BasicGroupSerializer < ApplicationSerializer
end
def include_bio_raw?
staff?
staff? || is_group_owner
end
def include_is_group_user?

View File

@ -1,6 +1,8 @@
require 'rails_helper'
describe BasicGroupSerializer do
let(:guardian) { Guardian.new }
let(:group) { Fabricate(:group) }
subject { described_class.new(group, scope: Guardian.new, root: false) }
describe '#display_name' do
@ -20,4 +22,22 @@ describe BasicGroupSerializer do
end
end
end
describe '#bio_raw' do
let(:group) { Fabricate(:group, bio_raw: 'testing') }
let(:user) do
user = Fabricate(:user)
group.add_owner(user)
user
end
let(:guardian) { Guardian.new(user) }
describe 'group owner' do
it 'should include bio_raw' do
expect(subject.bio_raw).to eq('testing')
end
end
end
end