# الرسائل المستوردة (المرسلة) لا تظهر في صندوق الوارد

**URL:** https://meta.discourse.org/t/imported-sent-messages-dont-show-in-the-mailbox/110527
**Category:** Support
**Created:** [2 مارس 2019، 9:13م UTC](https://meta.discourse.org/t/imported-sent-messages-dont-show-in-the-mailbox/110527 "2019-03-02T21:13:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nmcgovern](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nmcgovern/32/132630_2.png) [@nmcgovern](https://meta.discourse.org/u/nmcgovern)
#### Post date: [2 مارس 2019، 9:13م UTC](https://meta.discourse.org/t/imported-sent-messages-dont-show-in-the-mailbox/110527/1 "2019-03-02T21:13:16Z")

</div>

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_id`s 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 `username`s 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)

---

<div class="post-metadata">

### Author: ![nmcgovern](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nmcgovern/32/132630_2.png) [@nmcgovern](https://meta.discourse.org/u/nmcgovern)
#### Post date: [3 مارس 2019، 6:10م UTC](https://meta.discourse.org/t/imported-sent-messages-dont-show-in-the-mailbox/110527/2 "2019-03-03T18:10:07Z")

</div>

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. 🙄 I’ll go crawl into a hole now.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2 أبريل 2019، 6:10م UTC](https://meta.discourse.org/t/imported-sent-messages-dont-show-in-the-mailbox/110527/3 "2019-04-02T18:10:13Z")

</div>

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