# Distinguish private messages from posts?

**URL:** <https://meta.discourse.org/t/distinguish-private-messages-from-posts/51468>\
**Category:** Development\
**Created:** [Outubro 12, 2016, 9:12pm UTC](https://meta.discourse.org/t/distinguish-private-messages-from-posts/51468 "2016-10-12T21:12:09Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![tim.smith](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tim.smith/32/119954_2.png) [@tim.smith](https://meta.discourse.org/u/tim.smith)\
**Post date:** [Outubro 13, 2016, 4:19pm UTC](https://meta.discourse.org/t/distinguish-private-messages-from-posts/51468/15 "2016-10-13T16:19:18Z")

</div>

> [@Mittineague](#):
>
> Was this a topic that was admin wrenched into a message?

Nope. Just went to a user’s page and hit message. The first post does have private\_message set for the archetype, just not any of the subsequent replies in the PM; they’re all set to regular.

I did just find something really interesting. This is actually a UI bug, not a backend bug. When creating a reply, a POST is made to `{discourse site}/posts` with the following form data (formatted with linebreaks for your pleasure):

```plaintext
raw=this+is+another+reply+iok+asldfkjad
&unlist_topic=false
&category=
&topic_id=177
&is_warning=false
&whisper=false
&archetype=regular
&typing_duration_msecs=2000
&composer_open_duration_msecs=6168
&reply_to_post_number=6
&nested_post=true

```

Note how the UI is specifying `archetype=regular` in the post! I did some hacking and modified that same request to send `archetype=private_message`, and volia! The resulting event data has archetype set to private\_message. For fun, I set it to `archetype=shits_and_giggles`, and guess what? The resulting event also had archetype set to shits\_and\_giggles.

I’m rather surprised that UI code is providing data about the post and that discourse is sending that data back out without even validating it. It really seems like that data should be provided by the server, not the UI.

So, now that I’ve figured out where the “regular” value is coming from, could this be logged as a bug and fixed? Or point me to where the UI code is for this and I’ll see if I can figure out how to fix it?

---

_[View the full topic](https://meta.discourse.org/t/distinguish-private-messages-from-posts/51468)._
