Finish taking the multiple issues which Discourse had with the very large number of posts in this particular topic

This commit is contained in:
David Sainty 2024-12-07 17:10:36 +11:00
parent a6df981cae
commit 1885af1a34

View File

@ -1056,11 +1056,6 @@ class GossamerForumsImporter < ImportScripts::Base
# Remove ![http://data:image/, etc. as this is not supported.
sanitized_message.gsub!(/!\[data:image\/[^\]]+\]\([^)]+\)/, '')
# Ensure minimum length
if sanitized_message.strip.empty? || sanitized_message.length < 5
sanitized_message = "Empty post contents."
end
# Ensure sentence structure
unless sanitized_message.match?(/[.!?]\s|[.!?]$/)
sanitized_message += "."
@ -1084,6 +1079,11 @@ class GossamerForumsImporter < ImportScripts::Base
# Convert inline image syntax from `!(url)` to `![url](url)`
sanitized_message.gsub!(/!\((http[s]?:\/\/[^\)]+)\)/, '![\1](\1)')
# Ensure minimum length
if sanitized_message.strip.empty? || sanitized_message.length < 5
sanitized_message = "Empty post contents."
end
sanitized_message
end