File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ module PostValidations
88 validate :maximum_tag_length , if : -> { post_type . has_tags }
99 validate :no_spaces_in_tags , if : -> { post_type . has_tags }
1010 validate :stripped_minimum_body , if : -> { !body_markdown . nil? }
11- validate :stripped_minimum_title , if : -> { !title . nil? && ! [ 'HelpDoc' , 'PolicyDoc' ] . include? ( post_type . name ) }
11+ validate :stripped_minimum_title , if : -> { !title . nil? }
1212 validate :maximum_title_length , if : -> { !title . nil? }
1313 validate :required_tags? , if : -> { post_type . has_tags && post_type . has_category }
1414 end
@@ -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
You can’t perform that action at this time.
0 commit comments