Skip to content

Commit 298b9c8

Browse files
authored
Merge pull request #1197 from codidact/taeir/fix-validations-apply-to-help-policy
Skip min title validation for help/policy posts
2 parents 051adf7 + 4c46487 commit 298b9c8

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

app/models/concerns/post_validations.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ def stripped_minimum_body
4646
end
4747

4848
def stripped_minimum_title
49-
min_title = category.nil? ? 15 : category.min_title_length
49+
min_title = if ['HelpDoc', 'PolicyDoc'].include?(post_type.name)
50+
1
51+
elsif category.nil?
52+
15
53+
else
54+
category.min_title_length
55+
end
56+
5057
if (title&.gsub(/(?:^[\s\t\u2000-\u200F]+|[\s\t\u2000-\u200F]+$)/, '')&.length || 0) < min_title
5158
errors.add(:title, "must be more than #{min_title} non-whitespace characters long")
5259
end

0 commit comments

Comments
 (0)