From eeb5cb47981a75b8df4ab0a64b9963a6571d63c2 Mon Sep 17 00:00:00 2001 From: saint Date: Sat, 7 Dec 2024 15:08:35 +1100 Subject: [PATCH] Tackle the root issue with Discourse not playing ball with post min entropy 0 / post unclear issue --- goss-restorethread.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/goss-restorethread.rb b/goss-restorethread.rb index d3e863c..24f656b 100644 --- a/goss-restorethread.rb +++ b/goss-restorethread.rb @@ -1045,8 +1045,12 @@ class GossamerForumsImporter < ImportScripts::Base # Ensure the raw post string contents itself is acceptable to Discourse 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 - if sanitized_message.strip.empty? || sanitized_message.length < 3 + if sanitized_message.strip.empty? || sanitized_message.length < 5 sanitized_message = "Empty post contents." end @@ -1055,10 +1059,6 @@ class GossamerForumsImporter < ImportScripts::Base 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?/, '') - # Convert Gossamer tags to Discourse markdown sanitized_message.gsub!(/\[b\](.*?)\[\/b\]/, '**\1**') sanitized_message.gsub!(/\[i\](.*?)\[\/i\]/, '*\1*')