Tackle the root issue with Discourse not playing ball with post min entropy 0 / post unclear issue
This commit is contained in:
		@@ -1045,8 +1045,12 @@ class GossamerForumsImporter < ImportScripts::Base
 | 
				
			|||||||
    # Ensure the raw post string contents itself is acceptable to Discourse
 | 
					    # Ensure the raw post string contents itself is acceptable to Discourse
 | 
				
			||||||
    sanitized_message = message&.tr("\0", '') || ""
 | 
					    sanitized_message = message&.tr("\0", '') || ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Remove the [signature] as we don't support this in Discourse
 | 
				
			||||||
 | 
					#    sanitized_message.sub!(/\n?\[signature\]\n?\z/, '')
 | 
				
			||||||
 | 
					    sanitized_message.gsub(/\n?\[signature\]\n?/, '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Ensure minimum length
 | 
					    # Ensure minimum length
 | 
				
			||||||
    if sanitized_message.strip.empty? || sanitized_message.length < 3
 | 
					    if sanitized_message.strip.empty? || sanitized_message.length < 5
 | 
				
			||||||
      sanitized_message = "Empty post contents."
 | 
					      sanitized_message = "Empty post contents."
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1055,10 +1059,6 @@ class GossamerForumsImporter < ImportScripts::Base
 | 
				
			|||||||
      sanitized_message += "."
 | 
					      sanitized_message += "."
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Remove the [signature] as we don't support this in Discourse
 | 
					 | 
				
			||||||
#    sanitized_message.sub!(/\n?\[signature\]\n?\z/, '')
 | 
					 | 
				
			||||||
    sanitized_message.gsub(/\n?\[signature\]\n?/, '')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Convert Gossamer tags to Discourse markdown
 | 
					    # Convert Gossamer tags to Discourse markdown
 | 
				
			||||||
    sanitized_message.gsub!(/\[b\](.*?)\[\/b\]/, '**\1**')
 | 
					    sanitized_message.gsub!(/\[b\](.*?)\[\/b\]/, '**\1**')
 | 
				
			||||||
    sanitized_message.gsub!(/\[i\](.*?)\[\/i\]/, '*\1*')
 | 
					    sanitized_message.gsub!(/\[i\](.*?)\[\/i\]/, '*\1*')
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user