diff --git a/app/models/topic.rb b/app/models/topic.rb index 9271cc6c3b..598d434ea5 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -380,6 +380,7 @@ class Topic < ActiveRecord::Base self.set_or_create_timer( TopicTimer.types[:close], self.category.auto_close_hours, + by_user: Discourse.system_user, based_on_last_post: based_on_last_post, duration: duration ) diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb index 39d8a3bda2..36b6c1ec61 100644 --- a/spec/models/topic_spec.rb +++ b/spec/models/topic_spec.rb @@ -1580,6 +1580,7 @@ describe Topic do describe 'when new category is set to auto close by default' do before do new_category.update!(auto_close_hours: 5) + topic.user.update!(admin: true) end it 'should set a topic timer' do @@ -1592,6 +1593,7 @@ describe Topic do topic_timer = TopicTimer.last + expect(topic_timer.user).to eq(Discourse.system_user) expect(topic_timer.topic).to eq(topic) expect(topic_timer.execute_at).to eq_time(5.hours.from_now) end