Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: add slow_mode_prevents_editing setting..

mintsaxon7d0d13c32e5b
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 319b7728e81..61a2eef9705 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -1980,6 +1980,7 @@ en:
reviewable_low_priority_threshold: "The priority filter hides reviewable items that don't meet this score unless the '(any)' filter is used."
high_trust_flaggers_auto_hide_posts: "New user posts are automatically hidden after being flagged as spam by a TL3+ user"
cooldown_hours_until_reflag: "How much time users will have to wait until they are able to reflag a post"
+ slow_mode_prevents_editing: "Does 'Slow Mode' prevent editing, after editing_grace_period?"
reply_by_email_enabled: "Enable replying to topics via email."
reply_by_email_address: "Template for reply by email incoming email address, for example: %%{reply_key}@reply.example.com or replies+%%{reply_key}@example.com"
diff --git a/config/site_settings.yml b/config/site_settings.yml
index c9f957e8a64..6f7bb4d03b4 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -1731,6 +1731,7 @@ spam:
cooldown_hours_until_reflag:
default: 24
min: 0
+ slow_mode_prevents_editing: true
reviewable_claiming:
client: true
diff --git a/lib/post_revisor.rb b/lib/post_revisor.rb
index cbd5f71a5e5..a96e658a9e5 100644
--- a/lib/post_revisor.rb
+++ b/lib/post_revisor.rb
@@ -156,7 +156,7 @@ class PostRevisor
@revised_at = @opts[:revised_at] || Time.now
@last_version_at = @post.last_version_at || Time.now
- if guardian.affected_by_slow_mode?(@topic) && !ninja_edit?
+ if guardian.affected_by_slow_mode?(@topic) && !ninja_edit? && SiteSetting.slow_mode_prevents_editing
@post.errors.add(:base, I18n.t("cannot_edit_on_slow_mode"))
return false
end
diff --git a/spec/components/post_revisor_spec.rb b/spec/components/post_revisor_spec.rb
index 6832e9f5d7b..f8a76bee5ca 100644
--- a/spec/components/post_revisor_spec.rb
+++ b/spec/components/post_revisor_spec.rb
@@ -188,6 +188,16 @@ describe PostRevisor do
expect(post.errors).to be_empty
end
+ it 'edits are generally allowed' do
+ SiteSetting.slow_mode_prevents_editing = false
+
+ subject.revise!(post.user, { raw: 'updated body' }, revised_at: post.updated_at + 10.minutes)
+
+ post.reload
+
+ expect(post.errors).to be_empty
+ end
+
it 'staff is allowed to edit posts even if the topic is in slow mode' do
admin = Fabricate(:admin)
subject.revise!(admin, { raw: 'updated body' }, revised_at: post.updated_at + 10.minutes)