PM replies have wrong archetype

When replying to a PM, the UI sends the POST request to discourse and specifies archetype=general in the form data. It should be specifying archetype=private_message.

This causes an issue with server-side plugins using DiscourseEvent.on(:post_created). When inspecting the topic data, the archetype is specified as whatever value was provided by the UI. This means that the plugin will receive an archetype of “general” instead of “private_message” and therefore cannot distinguish between the two.

Additionally, literally any value can be specified by the UI; it is not checked server side. This means that not only is the value for PM replies incorrect, but that the value can’t be trusted to be accurate because it’s an unchecked value from the client.


Thing is “replies” have no archetype, the archetype is at the topic level.

Discourse Event should be either shipping nothing or the topic over.