Finish taking the multiple issues which Discourse had with the very large number of posts in this particular topic
This commit is contained in:
parent
a6df981cae
commit
1885af1a34
@ -1056,11 +1056,6 @@ class GossamerForumsImporter < ImportScripts::Base
|
|||||||
# Remove ![http://data:image/, etc. as this is not supported.
|
# Remove ![http://data:image/, etc. as this is not supported.
|
||||||
sanitized_message.gsub!(/!\[data:image\/[^\]]+\]\([^)]+\)/, '')
|
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
|
# Ensure sentence structure
|
||||||
unless sanitized_message.match?(/[.!?]\s|[.!?]$/)
|
unless sanitized_message.match?(/[.!?]\s|[.!?]$/)
|
||||||
sanitized_message += "."
|
sanitized_message += "."
|
||||||
@ -1084,6 +1079,11 @@ class GossamerForumsImporter < ImportScripts::Base
|
|||||||
# Convert inline image syntax from `!(url)` to `![url](url)`
|
# Convert inline image syntax from `!(url)` to `![url](url)`
|
||||||
sanitized_message.gsub!(/!\((http[s]?:\/\/[^\)]+)\)/, '![\1](\1)')
|
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
|
sanitized_message
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user