Skip to content

A platform for community discussion. Free, open, simple.

DEV: phpBB3 importer should get quoted username from actual post (#20979)

Gerhard Schlagerb24c35d88715
diff --git a/script/import_scripts/phpbb3/support/bbcode/xml_to_markdown.rb b/script/import_scripts/phpbb3/support/bbcode/xml_to_markdown.rb
index 9fee2e8cd91..004601d2471 100644
--- a/script/import_scripts/phpbb3/support/bbcode/xml_to_markdown.rb
+++ b/script/import_scripts/phpbb3/support/bbcode/xml_to_markdown.rb
@@ -203,8 +203,7 @@ module ImportScripts::PhpBB3::BBCode
def quoted_post(xml_node)
if @quoted_post_from_post_id
post_id = to_i(xml_node.attr("post_id"))
- username = quoted_username(xml_node)
- @quoted_post_from_post_id.call(post_id).merge({ username: username }) if post_id && username
+ @quoted_post_from_post_id.call(post_id) if post_id
end
end
diff --git a/script/import_scripts/phpbb3/support/text_processor.rb b/script/import_scripts/phpbb3/support/text_processor.rb
index fb788bf5370..8e7330bfa26 100644
--- a/script/import_scripts/phpbb3/support/text_processor.rb
+++ b/script/import_scripts/phpbb3/support/text_processor.rb
@@ -33,7 +33,11 @@ module ImportScripts::PhpBB3
username_from_user_id: lambda { |user_id| @lookup.find_username_by_import_id(user_id) },
smilie_to_emoji: lambda { |smilie| @smiley_processor.emoji(smilie).dup },
quoted_post_from_post_id:
- lambda { |post_id| @lookup.topic_lookup_from_imported_post_id(post_id) },
+ lambda do |post_id|
+ post_metadata = @lookup.topic_lookup_from_imported_post_id(post_id)
+ post_metadata[:username] ||= Post.joins(:user).where(id: post_id).pick(:username)
+ post_metadata
+ end,
upload_md_from_file:
(
lambda do |filename, index|