mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:17:36 +08:00
FIX: Topic timers being incorrectly trashed!
.
https://meta.discourse.org/t/temporary-timed-closure-of-topic-not-re-opening-topic/67877
This commit is contained in:
@ -1177,8 +1177,6 @@ describe Topic do
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
let(:trust_level_4) { Fabricate(:trust_level_4) }
|
||||
|
||||
before { Discourse.stubs(:system_user).returns(admin) }
|
||||
|
||||
it 'can take a number of hours as an integer' do
|
||||
freeze_time now
|
||||
|
||||
@ -1248,12 +1246,12 @@ describe Topic do
|
||||
|
||||
it 'sets topic status update user to system user if given user is not staff or a TL4 user' do
|
||||
topic.set_or_create_timer(TopicTimer.types[:close], 3, by_user: Fabricate.build(:user, id: 444))
|
||||
expect(topic.topic_timers.first.user).to eq(admin)
|
||||
expect(topic.topic_timers.first.user).to eq(Discourse.system_user)
|
||||
end
|
||||
|
||||
it 'sets topic status update user to system user if user is not given and topic creator is not staff nor TL4 user' do
|
||||
topic.set_or_create_timer(TopicTimer.types[:close], 3)
|
||||
expect(topic.topic_timers.first.user).to eq(admin)
|
||||
expect(topic.topic_timers.first.user).to eq(Discourse.system_user)
|
||||
end
|
||||
|
||||
it 'sets topic status update user to topic creator if it is a staff user' do
|
||||
@ -1280,6 +1278,15 @@ describe Topic do
|
||||
expect(closing_topic.reload.public_topic_timer.execute_at).to eq(2.days.from_now)
|
||||
end
|
||||
|
||||
it 'should not delete topic_timer of another status_type' do
|
||||
freeze_time
|
||||
closing_topic.set_or_create_timer(TopicTimer.types[:open], nil)
|
||||
topic_timer = closing_topic.public_topic_timer
|
||||
|
||||
expect(topic_timer.execute_at).to eq(5.hours.from_now)
|
||||
expect(topic_timer.status_type).to eq(TopicTimer.types[:close])
|
||||
end
|
||||
|
||||
it 'should allow status_type to be updated' do
|
||||
freeze_time
|
||||
|
||||
|
Reference in New Issue
Block a user