mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: auto-close topics based on last post
This commit is contained in:
parent
ac72b0bcf6
commit
5754e8dd0f
28 changed files with 242 additions and 146 deletions
|
@ -76,6 +76,7 @@ class PostCreator
|
|||
store_unique_post_key
|
||||
track_topic
|
||||
update_topic_stats
|
||||
update_topic_auto_close
|
||||
update_user_counts
|
||||
create_embedded_topic
|
||||
|
||||
|
@ -208,6 +209,12 @@ class PostCreator
|
|||
@topic.update_attributes(attrs)
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
def setup_post
|
||||
@opts[:raw] = TextCleaner.normalize_whitespaces(@opts[:raw]).gsub(/\s+\z/, "")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue