diff --git a/plugin.rb b/plugin.rb index 0d727d1..a6462c7 100644 --- a/plugin.rb +++ b/plugin.rb @@ -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 diff --git a/spec/integration/solved_spec.rb b/spec/integration/solved_spec.rb index e39a87e..f1cd055 100644 --- a/spec/integration/solved_spec.rb +++ b/spec/integration/solved_spec.rb @@ -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