# Post attributes not correctly set on staged posts when saved?

**URL:** https://meta.discourse.org/t/post-attributes-not-correctly-set-on-staged-posts-when-saved/28571
**Category:** Bug
**Created:** [2015年五月10日 00:23 UTC](https://meta.discourse.org/t/post-attributes-not-correctly-set-on-staged-posts-when-saved/28571 "2015-05-10T00:23:13Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![lukegb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lukegb/32/114920_2.png) [@lukegb](https://meta.discourse.org/u/lukegb)
#### Post date: [2015年五月10日 00:23 UTC](https://meta.discourse.org/t/post-attributes-not-correctly-set-on-staged-posts-when-saved/28571/1 "2015-05-10T00:23:13Z")

</div>

I’ve noticed that the user class attributes don’t seem to be set correctly (on the poster-name component) when a post is saved from the composer. Obviously the issue goes away when the page is refreshed and it’s only evident for the person who posted it, but it’s annoying none-the-less - we apply some theming based on a user’s primary group.

I note that a subset of a post’s attributes are set here:

> <https://github.com/discourse/discourse/blob/bed7781fe21edd1ac7369d81fb3c1584186ed025/app/assets/javascripts/discourse/models/composer.js.es6#L474-L492>

but that doesn’t include attributes like `staff` or `primary_group_name`.

Is this an actual bug or expected behaviour? What would be the correct way to fix it - just add the new attributes, or replace the post in the post stream with the version of the post from the server?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015年五月11日 03:26 UTC](https://meta.discourse.org/t/post-attributes-not-correctly-set-on-staged-posts-when-saved/28571/2 "2015-05-11T03:26:03Z")

</div>

@eviltrout your thoughts?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [2015年五月11日 15:50 UTC](https://meta.discourse.org/t/post-attributes-not-correctly-set-on-staged-posts-when-saved/28571/3 "2015-05-11T15:50:29Z")

</div>

> [@lukegb](#):
>
> Is this an actual bug or expected behaviour?

It certainly sounds like a bug to me. However, some properties might come back from the server in the response and will be set that way.

We should do what we can to make sure that the properties set after saving succeeds are the same as when refreshing the page.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2016年七月2日 07:45 UTC](https://meta.discourse.org/t/post-attributes-not-correctly-set-on-staged-posts-when-saved/28571/4 "2016-07-02T07:45:40Z")

</div>

Is this still an issue, one year later?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [2016年七月4日 16:33 UTC](https://meta.discourse.org/t/post-attributes-not-correctly-set-on-staged-posts-when-saved/28571/5 "2016-07-04T16:33:49Z")

</div>

I haven’t heard any complaints about it. I suspect there are some properties that still work this way – I’m just not sure if they result in any particular bugs.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2022年七月21日 05:32 UTC](https://meta.discourse.org/t/post-attributes-not-correctly-set-on-staged-posts-when-saved/28571/6 "2022-07-21T05:32:55Z")

</div>


