OP of warnings not highlighted with Staff Color

Priority/Severity: normal

Platform: at least on desktop & mobile

Description: When moderators send a warning to a user, I remember that in the DIscourse version at least 1 year ago, the OP of the warning should be a background highlighted with Staff Color. But using Discourse v3.5.0.beta9, the OP has the normal background.

Reproducible steps: Send a warning to a user on Discourse v3.5.0.beta9.

2 Likes

Same issue. Wonder if it’s a bug or intended.

1 Like

I feel like this may have been an intentional change @hugh would probably know.

1 Like

Hi folks,

I was investigating why warning PM first posts lost their staff color styling after the Glimmer post stream migration, and wanted to share what I found — it looks like a small oversight rather than an intentional change (at least on the code side).

The issue

In post.gjs (line 436), the moderator CSS class is applied based on:

(if
  (or @post.isModeratorAction (and @post.isWarning @post.firstPost))
  "post--moderator moderator"
  "post--regular regular"
)

@post.isModeratorAction works correctly — it’s a proper getter on the Post model. But @post.isWarning doesn’t exist on the Post model at all.

No isWarning property, getter, or tracked field is defined there. So the condition (and @post.isWarning @post.firstPost) always evaluates to false, and the moderator class is never applied to warning PM first posts.

How it worked before

In the old widget system, transformPost (transform-post.js) explicitly mapped the topic-level flag to the post attrs:

postAtts.isWarning = topic.is_warning;

Then widgets/post.js checked attrs.isWarning && attrs.firstPost to apply the moderator class. This bridge was lost during the Glimmer migration.

My read on it

Since post.gjs actively references @post.isWarning, it seems like the intent was to preserve this behavior. If removing the staff color from warnings was intentional, then the (and @post.isWarning @post.firstPost) branch in post.gjs is dead code and could be cleaned up. If it’s a bug (which seems more likely given the old widget code), the fix would be a small getter on the Post model:

get isWarning() {
  return this.topic?.is_warning;
}

I wanted to check what the team’s take is — does this look like an oversight from the Glimmer migration, or was it intentionally left out? Either way, the dead reference to @post.isWarning in post.gjs might be worth addressing.

Thanks!

3 Likes

That’s interesting the way the code was written, hope someone from the team can reply to your question there about if there was oversight in that or was written that way for some other reason.

2 Likes

Great report thanks, it’s exactly as you described. I’m applying a fix here:

2 Likes