Hi all,
I’m trying to migrate a rather large site over to discourse from some sort of terrible mix of joomla plugins. The good news is that I’ve got sorted most of the items, except for private messages.
I get a list of all private messages from mysql, call create_posts(result_map, total_count, offset) on the result.
For posts without a parent, I set
:archetype = Archetype.private_message:title = # first line of the message:target_usernames = fromusername,tousername
As I understand it, this should make PostCreator create a topic first, and then a post for that topic.
This is indeed what happens. However, when I view my mailbox, the message doesn’t appear.
Looking in postgres, the topic is indeed created, it has the right archetype (private_message) and subtype (user_to_user), deleted_at is nil, and closed/archived are both false.
This matches another message I sent via the web interface to see if there was a disparity.
I’ve verified that the right user_ids are in topic_allowed_users.
I initially thought it may have something to do with the older date it was imported, but I’ve tried looking through the source of TopicQuery, and can’t seem to see anything immediately that would prevent these from turning up.
Does anyone have any ideas on this?
(As an aside, it seems that PostCreator failing to add the right topic_allowed_users because possibly I may have been passing user_ids rather than usernames does so silently, rather than populating post_creator.errors.full_messages. post simply becomes a string with the error message. I’ll open a bug about this)
I’ll go crawl into a hole now.