Private Messages 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:

4 Likes