From 18cb1cc2e5dbfebb2da06ee64416a8dcd3252ec9 Mon Sep 17 00:00:00 2001 From: saint Date: Fri, 12 Jul 2024 23:57:27 +1000 Subject: [PATCH] v0.31.1 Significant update of private message code - field population, threading of replies, visibility to sender --- gossamer_forums.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 014ce2d..1227322 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,5 +1,5 @@ # gossamer threads migration-import code -# v0.31 +# v0.31.1 require 'mysql2' require 'open-uri' @@ -1190,7 +1190,7 @@ class GossamerForumsImporter < ImportScripts::Base puts "Highest processed personal_id: #{highest_processed_personal_id}" # OVERRIDE - to speed getting to problem msg -# highest_processed_personal_id = 350 + highest_processed_personal_id = 1543840 puts "Highest processed personal_id override: #{highest_processed_personal_id}" execute_query("SELECT * FROM gforum_Message").each do |row| @@ -1223,11 +1223,15 @@ class GossamerForumsImporter < ImportScripts::Base sanitized_title = "" if sanitized_title.nil? || sanitized_title.empty? # Check for an existing private message topic between the same two users with a similar title - topic = Topic.joins(:topic_allowed_users, :custom_fields) - .where(archetype: Archetype.private_message) +# topic = Topic.joins(:topic_allowed_users, :custom_fields) +# .where(archetype: Archetype.private_message) +# .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}") +# .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}") - .where(topic_custom_fields: { name: 'original_gossamer_msg_id' }) .first if topic.nil?