Imported (sent) messages don't show in the mailbox

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)

2 Likes

Ok, more fun!

It seems that the topic does turn up via the API in /topics/private-messages-sent/username.json, but not in /topics/private-messages/username.json.

Also, if I go to the topic id URL directly at http://localhost:3000/t/neil-private-message/8695, it appears fine with the message icon, and the reply.

Am I perhaps missing something about where private messages should appear in the web UI or something?

Edit: Yes, yes I am stupid. It would help to click on ‘sent’ in the messages UI to view sent messages. :roll_eyes: I’ll go crawl into a hole now.

5 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.