From e47af9bb72dd72c58272fb1abca631e6c118ece9 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 24 Mar 2023 19:11:57 +0000 Subject: [PATCH] FIX: Check for staff without triggering anonymous user error (#20819) Followup to 142d2ab65ecf31a1df1d0cd23e533d84c120b683 --- .../javascripts/discourse/app/widgets/header-contents.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/widgets/header-contents.js b/app/assets/javascripts/discourse/app/widgets/header-contents.js index cdaa2f134da..b74d1681c5d 100644 --- a/app/assets/javascripts/discourse/app/widgets/header-contents.js +++ b/app/assets/javascripts/discourse/app/widgets/header-contents.js @@ -3,6 +3,11 @@ import hbs from "discourse/widgets/hbs-compiler"; createWidget("header-contents", { tagName: "div.contents.clearfix", + transform() { + return { + staff: this.get("currentUser.staff"), + }; + }, template: hbs` {{#if this.site.desktopView}} {{#if attrs.sidebarEnabled}} @@ -15,7 +20,7 @@ createWidget("header-contents", { {{#if attrs.topic}} {{header-topic-info attrs=attrs}} {{else if this.siteSettings.bootstrap_mode_enabled}} - {{#if this.currentUser.staff}} + {{#if transformed.staff}} {{header-bootstrap-mode attrs=attrs}} {{/if}} {{/if}}