FEATURE: Do not check consecutive replies for original poster. (#6714)

This commit is contained in:
Bianca Nenciu
2018-12-03 12:32:29 +02:00
committed by Jeff Atwood
parent 142361d6da
commit 3f8fa4ad4e
2 changed files with 13 additions and 0 deletions

View File

@ -146,6 +146,7 @@ class Validators::PostValidator < ActiveModel::Validator
return if SiteSetting.max_consecutive_replies == 0 || post.id || post.acting_user&.staff? || private_message?(post)
topic = post.topic
return if topic.posts.first&.user == post.user
last_posts_count = DB.query_single(<<~SQL, topic_id: post.topic_id, user_id: post.acting_user.id, max_replies: SiteSetting.max_consecutive_replies).first
SELECT COUNT(*)