FEATURE - Category group moderators can (un)accept solutions, if enabled (#89)
This commit is contained in:
parent
36579b774f
commit
6f1cf5a779
|
@ -472,6 +472,10 @@ SQL
|
|||
return true if is_staff?
|
||||
return true if current_user.trust_level >= SiteSetting.accept_all_solutions_trust_level
|
||||
|
||||
if respond_to? :can_perform_action_available_to_group_moderators?
|
||||
return true if can_perform_action_available_to_group_moderators?(topic)
|
||||
end
|
||||
|
||||
topic.user_id == current_user.id && !topic.closed
|
||||
|
||||
end
|
||||
|
|
|
@ -148,4 +148,21 @@ RSpec.describe "Managing Posts solved status" do
|
|||
expect(payload["id"]).to eq(p1.id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'group moderators' do
|
||||
fab!(:group_user) { Fabricate(:group_user) }
|
||||
let(:user_gm) { group_user.user }
|
||||
let(:group) { group_user.group }
|
||||
|
||||
before do
|
||||
SiteSetting.enable_category_group_moderation = true
|
||||
p1.topic.category.update!(reviewable_by_group_id: group.id)
|
||||
sign_in(user_gm)
|
||||
end
|
||||
|
||||
it 'can accept a solution' do
|
||||
post "/solution/accept.json", params: { id: p1.id }
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue