diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 1227322..eec623d 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,5 +1,5 @@ # gossamer threads migration-import code -# v0.31.1 +# v0.31.2 require 'mysql2' require 'open-uri' @@ -1229,10 +1229,11 @@ class GossamerForumsImporter < ImportScripts::Base # .where("title = ? OR title = ?", sanitized_title, "Re: #{sanitized_title}") # .where(topic_custom_fields: { name: 'original_gossamer_msg_id' }) # .first - topic = Topic.where.joins(:topic_allowed_users) - .where("topic_allowed_users.user_id = ? AND topic_allowed_users.user_id = ?", from_user_id, to_user_id) - .where("title = ? OR title = ?", sanitized_title, "Re: #{sanitized_title}") - .first + topic = Topic.where(archetype: Archetype.private_message) + .where("topics.title = ? OR topics.title = ? OR topics.title = ?", sanitized_title, "Re: #{sanitized_title}", "Re: #{sanitized_title.strip}") + .where("topics.topic_allowed_users.user_id = ? AND topics.topic_allowed_users.user_id = ?", from_user_id, to_user_id) +# .where("((topics.user_id = ? AND topics.topic_allowed_users.user_id = ?) OR (topics.user_id = ? AND topics.topic_allowed_users.user_id = ?))", from_user_id, to_user_id, to_user_id, from_user_id) + .first if topic.nil? puts "IMPORTING new message topic sanitized: #{sanitized_title} user_id #{from_user_id} to_user_id #{to_user_id}" @@ -1301,17 +1302,17 @@ class GossamerForumsImporter < ImportScripts::Base puts "Starting Gossamer Forums import... #{timestamp}" - add_former_user +# add_former_user # import_users # export_username_mapping_to_csv("gossamer-migration-username-mapping#{timestamp}") # import_categories # # # import_topics_and_posts_with_attachments - update_topic_stats - update_user_stats - export_url_mapping_to_csv("gossamer-migration-url-mapping#{timestamp}") - create_nginx_rewrite_rules("gossamer-redirects#{timestamp}.conf") +# update_topic_stats +# update_user_stats +# export_url_mapping_to_csv("gossamer-migration-url-mapping#{timestamp}") +# create_nginx_rewrite_rules("gossamer-redirects#{timestamp}.conf") import_personal_messages