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

The actual code in the import script didn't match the expected behavior as defined by the specs. This fixes it and is a follow-up to ad32fa56
This commit is contained in:
Gerhard Schlager 2023-04-05 15:43:20 +02:00 committed by GitHub
parent ad32fa5690
commit b24c35d887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -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|