mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
FIX: Adding a public topic timer deletes a private topic timer.
This commit is contained in:
parent
5881355006
commit
1310181664
@ -1022,8 +1022,9 @@ SQL
|
||||
def set_or_create_timer(status_type, time, by_user: nil, timezone_offset: 0, based_on_last_post: false, category_id: SiteSetting.uncategorized_category_id)
|
||||
return delete_topic_timer(status_type, by_user: by_user) if time.blank?
|
||||
|
||||
topic_timer_options = { topic: self }
|
||||
topic_timer_options.merge!(user: by_user) unless TopicTimer.public_types[status_type]
|
||||
public_topic_timer = !!TopicTimer.public_types[status_type]
|
||||
topic_timer_options = { topic: self, public_type: public_topic_timer }
|
||||
topic_timer_options.merge!(user: by_user) unless public_topic_timer
|
||||
topic_timer = TopicTimer.find_or_initialize_by(topic_timer_options)
|
||||
topic_timer.status_type = status_type
|
||||
|
||||
|
@ -1333,6 +1333,14 @@ describe Topic do
|
||||
}.to change { TopicTimer.count }.by(1)
|
||||
end
|
||||
|
||||
it 'should not be override when setting a public topic timer' do
|
||||
reminder
|
||||
|
||||
expect do
|
||||
topic.set_or_create_timer(TopicTimer.types[:close], 3, by_user: reminder.user)
|
||||
end.to change { TopicTimer.count }.by(1)
|
||||
end
|
||||
|
||||
it "can update a user's existing record" do
|
||||
freeze_time now
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user