FIX: Ensure autoclose based on last post is executed by system user.
This commit is contained in:
parent
ffc5bb7278
commit
1e8f216e17
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue