OP van waarschuwingen niet gemarkeerd met Staff Kleur

Prioriteit/Ernst: normaal

Platform: ten minste op desktop en mobiel

Beschrijving: Wanneer moderators een waarschuwing naar een gebruiker sturen, herinner ik me dat in de Discourse-versie van minstens 1 jaar geleden, de OP van de waarschuwing een achtergrond met Staff-kleur moest hebben. Maar met Discourse v3.5.0.beta9 heeft de OP de normale achtergrond.

Reproduceerbare stappen: Stuur een waarschuwing naar een gebruiker op Discourse v3.5.0.beta9.

2 likes

Hetzelfde probleem. Vraag me af of het een bug is of opzet.

1 like

Ik heb het gevoel dat dit een opzettelijke wijziging is geweest, @hugh zou het waarschijnlijk weten.

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.

1 like

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

1 like