2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

FEATURE: Allow admin to auto reopen at topic.

* This commit also introduces a `TopicStatusUpdate`
  model to support other forms of deferred topic
  status update in the future.
This commit is contained in:
Guo Xiang Tan 2017-03-22 11:12:02 +08:00
parent 12e02873fc
commit 34b7bee568
52 changed files with 1442 additions and 955 deletions

View file

@ -390,8 +390,16 @@ class PostCreator
end
def update_topic_auto_close
if @topic.auto_close_based_on_last_post && @topic.auto_close_hours
@topic.set_auto_close(@topic.auto_close_hours).save
topic_status_update = @topic.topic_status_update
if topic_status_update &&
topic_status_update.based_on_last_post &&
topic_status_update.duration > 0
@topic.set_or_create_status_update(TopicStatusUpdate.types[:close],
topic_status_update.duration,
based_on_last_post: topic_status_update.based_on_last_post
)
end
end