From b542dcfd27978f517a86b85671c97472c72a50bd Mon Sep 17 00:00:00 2001 From: saint Date: Sat, 13 Jul 2024 01:38:08 +1000 Subject: [PATCH] v0.31.3 Significant update of private message code - field population, threading of replies, visibility to sender --- gossamer_forums.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 8db1c07..f4bad20 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,5 +1,5 @@ # gossamer threads migration-import code -# v0.31.3 +# v0.31.4 require 'mysql2' require 'open-uri' @@ -1231,11 +1231,12 @@ class GossamerForumsImporter < ImportScripts::Base # .first topic = Topic.joins(:topic_allowed_users) .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.title = ? OR topics.title = ?", sanitized_title, sanitized_title.gsub(/^Re: /, "")) .where("topic_allowed_users.user_id IN (?)", [from_user_id, to_user_id]) .group("topics.id") .having("COUNT(topic_allowed_users.user_id) = 2") .first +# .where("topics.title = ? OR topics.title = ?", sanitized_title, sanitized_title.gsub(/^Re: /, "")) # .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)