diff --git a/app/assets/javascripts/discourse/app/components/edit-category-settings.js b/app/assets/javascripts/discourse/app/components/edit-category-settings.js index bfcfa19cd5e..93947368f3e 100644 --- a/app/assets/javascripts/discourse/app/components/edit-category-settings.js +++ b/app/assets/javascripts/discourse/app/components/edit-category-settings.js @@ -138,4 +138,10 @@ export default buildCategoryPanel("settings", { let hours = minutes ? minutes / 60 : null; this.set("category.auto_close_hours", hours); }, + + @action + onDefaultSlowModeDurationChange(minutes) { + let seconds = minutes ? minutes * 60 : null; + this.set("category.default_slow_mode_seconds", seconds); + }, }); diff --git a/app/assets/javascripts/discourse/app/models/category.js b/app/assets/javascripts/discourse/app/models/category.js index af65076dba4..940bb5ba39e 100644 --- a/app/assets/javascripts/discourse/app/models/category.js +++ b/app/assets/javascripts/discourse/app/models/category.js @@ -177,6 +177,11 @@ const Category = RestModel.extend({ return topicCount; }, + @discourseComputed("default_slow_mode_seconds") + defaultSlowModeMinutes(seconds) { + return seconds ? seconds / 60 : null; + }, + save() { const id = this.id; const url = id ? `/categories/${id}` : "/categories"; @@ -193,6 +198,7 @@ const Category = RestModel.extend({ auto_close_based_on_last_post: this.get( "auto_close_based_on_last_post" ), + default_slow_mode_seconds: this.default_slow_mode_seconds, position: this.position, email_in: this.email_in, email_in_allow_strangers: this.email_in_allow_strangers, diff --git a/app/assets/javascripts/discourse/app/templates/components/edit-category-settings.hbs b/app/assets/javascripts/discourse/app/templates/components/edit-category-settings.hbs index 78c3414a364..8dc72c57022 100644 --- a/app/assets/javascripts/discourse/app/templates/components/edit-category-settings.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/edit-category-settings.hbs @@ -116,6 +116,21 @@ +
+
+ +
+ {{relative-time-picker + id="category-default-slow-mode" + durationMinutes=category.defaultSlowModeMinutes + hiddenIntervals=hiddenRelativeIntervals + onChange=(action "onDefaultSlowModeDurationChange")}} +
+
+
+