Private Messages how to put to inbox from sent when imported from vanilla

AI-generated summary

Cyan_Suntay imported 2 million private messages from Vanilla but struggled to move them from the “sent” category to the inbox. Ghan explained that the issue lies in the participant_count field, which isn’t updated during import. To resolve this, you can either modify the importer to include participant counts or run the command Topic.private_messages.map(&:update_statistics) in the Rails console. Ghan provided a link to a relevant discussion: Imported private discussion doesn’t appear in the author inbox. Cyan_Suntay confirmed that the solution worked, showing both users in a conversation.

Imported 2million Private Messages but how to put to inbox from sent when imported from vanilla

Typically, the Inbox will only contain private messages where either:

  1. You received the private message sent by someone else.
  2. Someone has replied to a private message that you sent.

I’ve noticed with importing from other boards that private messages in category #2 don’t appear to show properly in the Inbox, even when the topic does have replies. This appears to be due to a condition on the query for the Inbox that pertains to the participant_count field of the topic. The importer doesn’t properly update this field, so it is set to 1 by default. When the participant_count is 1, the query will not return that topic for display in the Inbox view.

To fix this, you’ll need to either adjust the importer to include a count of participants in the private message, or update the participant count after the import, which can be accomplished by running this on the rails console:

Topic.private_messages.map(&:update_statistics)

More here:

Thanks Ghan! it worked to show both of users in a conversation.