A platform for community discussion. Free, open, simple.
FIX: Hide experimental user navigation changes when disabled (#18327)
David Taylor7a622f22bc87
diff --git a/app/assets/javascripts/discourse/app/controllers/user.js b/app/assets/javascripts/discourse/app/controllers/user.jsindex 800f63926e6..1c00e2fd7c3 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.hbsindex b960377ac2a..c3b1e4e4192 100644--- a/app/assets/javascripts/discourse/app/templates/user.hbs+++ b/app/assets/javascripts/discourse/app/templates/user.hbs@@ -66,7 +66,7 @@</li>{{/if}}- {{#if (and this.site.desktopView this.currentUser.staff)}}+ {{#if this.displayTopLevelAdminButton}}<li><a href={{this.model.adminPath}} class="btn btn-default">{{d-icon "wrench"}}<span class="d-button-label">{{i18n "admin.user.show_admin_profile"}}</span></a></li>{{/if}}@@ -78,7 +78,7 @@</li>{{/if}}- {{#if this.site.mobileView}}+ {{#if (and this.site.mobileView this.currentUser.redesigned_user_page_nav_enabled)}}<li><DButton @class="btn-default toggle-mobile-user-menu" @action={{this.toggleUserNav}} @icon="bars" @label="hamburger_menu" /></li>