v0.31.2 Significant update of private message code - field population, threading of replies, visibility to sender

This commit is contained in:
David Sainty 2024-07-13 00:53:39 +10:00
parent 18cb1cc2e5
commit 8e0466ac8f

View File

@ -1,5 +1,5 @@
# gossamer threads migration-import code
# v0.31.1
# v0.31.2
require 'mysql2'
require 'open-uri'
@ -1229,9 +1229,10 @@ 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}")
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?
@ -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