diff --git a/plugin.rb b/plugin.rb index 6db948e..9388a8d 100644 --- a/plugin.rb +++ b/plugin.rb @@ -108,7 +108,7 @@ SQL ) end - if (auto_close_hours = SiteSetting.solved_topics_auto_close_hours) > 0 + if (auto_close_hours = SiteSetting.solved_topics_auto_close_hours) > 0 and !topic.closed topic.set_or_create_timer( TopicTimer.types[:close], auto_close_hours, diff --git a/spec/integration/solved_spec.rb b/spec/integration/solved_spec.rb index 73891e8..5dd6afe 100644 --- a/spec/integration/solved_spec.rb +++ b/spec/integration/solved_spec.rb @@ -27,5 +27,18 @@ RSpec.describe "Managing Posts solved status" do expect(topic.public_topic_timer.based_on_last_post).to eq(true) end + it 'does not set a timer when the topic is closed' do + topic2.update!(closed: true) + xhr :post, "/solution/accept", id: p2.id + + p2.reload + topic2.reload + + expect(p2.custom_fields["is_accepted_answer"]).to eq("true") + + expect(topic2.public_topic_timer).to eq(nil) + + expect(topic2.closed).to eq(true) + end end end