v0.25.1 Another post content corner case handling for Discourse validation to pass
This commit is contained in:
parent
1600e91ba4
commit
2627530d48
@ -1,5 +1,5 @@
|
||||
# gossamer threads migration-import code
|
||||
# v0.25
|
||||
# v0.25.1
|
||||
|
||||
require 'mysql2'
|
||||
require 'open-uri'
|
||||
@ -781,6 +781,16 @@ class GossamerForumsImporter < ImportScripts::Base
|
||||
# Ensure the raw post string contents itself is acceptable to Discourse
|
||||
sanitized_message = message&.tr("\0", '') || ""
|
||||
|
||||
# Ensure minimum length
|
||||
if sanitized_message.strip.empty? || sanitized_message.length < 3
|
||||
sanitized_message = "Empty post contents."
|
||||
end
|
||||
|
||||
# Ensure sentence structure
|
||||
unless sanitized_message.match?(/[.!?]\s|[.!?]$/)
|
||||
sanitized_message += "."
|
||||
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?/, '')
|
||||
|
Loading…
Reference in New Issue
Block a user