mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Per-category default slow mode duration for topics.
When configured, all topics in the category inherits the slow mode duration from the category's default. Note that currently there is no way to remove the slow mode from the topics once it has been set.
This commit is contained in:
committed by
Alan Guo Xiang Tan
parent
0ea58fe51f
commit
7162ecfb04
@@ -334,6 +334,7 @@ class Topic < ActiveRecord::Base
|
||||
|
||||
if category_id_changed? || new_record?
|
||||
inherit_auto_close_from_category
|
||||
inherit_slow_mode_from_category
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1251,6 +1252,12 @@ class Topic < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def inherit_slow_mode_from_category
|
||||
if self.category&.default_slow_mode_seconds
|
||||
self.slow_mode_seconds = self.category&.default_slow_mode_seconds
|
||||
end
|
||||
end
|
||||
|
||||
def inherit_auto_close_from_category(timer_type: :close)
|
||||
auto_close_hours = self.category&.auto_close_hours
|
||||
|
||||
|
||||
Reference in New Issue
Block a user