הודעת הפותח של אזהרות לא מודגשת בצבע צוות

עדיפות/חומרה: רגיל

פלטפורמה: לפחות בשולחן עבודה ובנייד

תיאור: כאשר מנהלים שולחים אזהרה למשתמש, אני זוכר שבגרסת Discourse מלפני שנה לפחות, ה-OP של האזהרה אמור להיות מודגש ברקע בצבע צוות. אך בשימוש ב-Discourse v3.5.0.beta9, ה-OP הוא עם רקע רגיל.

שלבי שחזור: שלח אזהרה למשתמש ב-Discourse v3.5.0.beta9.

2 לייקים

אותה בעיה. תוהה אם זו באג או בכוונה.

לייק 1

אני חושב שזה יכול היה להיות שינוי מכוון, @hugh כנראה ידע.

לייק 1

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 לייקים

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 לייקים

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

2 לייקים