mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:34:50 +08:00
A few small changes to the phpBB3 importer (#4321)
* Reconnect to phpBB3 database on connection loss * Map geek smiley to :nerd: emoji in phpBB3 importer * Import PMs to yourself from phpBB3 * Allow empty table prefix in phpBB3 importer
This commit is contained in:

committed by
Régis Hanol

parent
4d65370797
commit
c145e747b6
@ -56,7 +56,7 @@ module ImportScripts::PhpBB3
|
||||
mapped[:target_usernames] = get_recipient_usernames(row)
|
||||
mapped[:custom_fields] = {import_user_ids: current_user_ids.join(',')}
|
||||
|
||||
if mapped[:target_usernames].empty? # pm with yourself?
|
||||
if mapped[:target_usernames].empty?
|
||||
puts "Private message without recipients. Skipping #{row[:msg_id]}: #{row[:message_subject][0..40]}"
|
||||
return nil
|
||||
end
|
||||
@ -80,11 +80,10 @@ module ImportScripts::PhpBB3
|
||||
end
|
||||
|
||||
def get_recipient_usernames(row)
|
||||
author_id = row[:author_id].to_s
|
||||
import_user_ids = get_recipient_user_ids(row[:to_address])
|
||||
|
||||
import_user_ids.map! do |import_user_id|
|
||||
import_user_id.to_s == author_id ? nil : @lookup.find_user_by_import_id(import_user_id).try(:username)
|
||||
@lookup.find_user_by_import_id(import_user_id).try(:username)
|
||||
end.compact
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user