Post attributes not correctly set on staged posts when saved?

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?

3 Likes

@eviltrout your thoughts?

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.

3 Likes

Is this still an issue, one year later?

1 Like

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.

1 Like