From 7a622f22bc8720e1bef0a583a781d2d508eb9eda Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 22 Sep 2022 10:26:01 +0100 Subject: [PATCH] FIX: Hide experimental user navigation changes when disabled (#18327) Followup to b066955838b0107b34b9ea7bce073632c73eeedc --- .../javascripts/discourse/app/controllers/user.js | 11 +++++++++++ .../javascripts/discourse/app/templates/user.hbs | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/app/controllers/user.js b/app/assets/javascripts/discourse/app/controllers/user.js index 800f63926e..1c00e2fd7c 100644 --- a/app/assets/javascripts/discourse/app/controllers/user.js +++ b/app/assets/javascripts/discourse/app/controllers/user.js @@ -198,6 +198,17 @@ export default Controller.extend(CanCheckEmails, { this.toggleProperty("displayUserNav"); }, + get displayTopLevelAdminButton() { + if (!this.currentUser?.staff) { + return false; + } + if (this.currentUser?.redesigned_user_page_nav_enabled) { + return this.site.desktopView; + } else { + return true; + } + }, + actions: { collapseProfile() { this.set("forceExpand", false); diff --git a/app/assets/javascripts/discourse/app/templates/user.hbs b/app/assets/javascripts/discourse/app/templates/user.hbs index b960377ac2..c3b1e4e419 100644 --- a/app/assets/javascripts/discourse/app/templates/user.hbs +++ b/app/assets/javascripts/discourse/app/templates/user.hbs @@ -66,7 +66,7 @@ {{/if}} - {{#if (and this.site.desktopView this.currentUser.staff)}} + {{#if this.displayTopLevelAdminButton}}
  • {{d-icon "wrench"}}{{i18n "admin.user.show_admin_profile"}}
  • {{/if}} @@ -78,7 +78,7 @@ {{/if}} - {{#if this.site.mobileView}} + {{#if (and this.site.mobileView this.currentUser.redesigned_user_page_nav_enabled)}}