diff --git a/plugins/chat/assets/javascripts/discourse/connectors/user-preferences-nav/preferences-chat-link.hbs b/plugins/chat/assets/javascripts/discourse/connectors/user-preferences-nav/preferences-chat-link.hbs index a2df70a7e01..75fc6a694b3 100644 --- a/plugins/chat/assets/javascripts/discourse/connectors/user-preferences-nav/preferences-chat-link.hbs +++ b/plugins/chat/assets/javascripts/discourse/connectors/user-preferences-nav/preferences-chat-link.hbs @@ -1,4 +1,4 @@ -{{#if (or this.model.can_chat this.model.admin)}} +{{#if (or this.model.can_chat this.currentUser.admin)}} {{i18n "chat.title_capitalized"}} diff --git a/plugins/chat/assets/javascripts/discourse/routes/preferences-chat.js b/plugins/chat/assets/javascripts/discourse/routes/preferences-chat.js index 06985980aaf..07da3697c57 100644 --- a/plugins/chat/assets/javascripts/discourse/routes/preferences-chat.js +++ b/plugins/chat/assets/javascripts/discourse/routes/preferences-chat.js @@ -8,7 +8,7 @@ export default class PreferencesChatRoute extends RestrictedUserRoute { showFooter = true; setupController(controller, user) { - if (!user?.can_chat && !user.admin) { + if (!user?.can_chat && !this.currentUser.admin) { return this.transitionTo(`discovery.${defaultHomepage()}`); } controller.set("model", user); diff --git a/plugins/chat/spec/system/user_chat_preferences_spec.rb b/plugins/chat/spec/system/user_chat_preferences_spec.rb index 6543f24057c..70adf38e6f6 100644 --- a/plugins/chat/spec/system/user_chat_preferences_spec.rb +++ b/plugins/chat/spec/system/user_chat_preferences_spec.rb @@ -34,7 +34,7 @@ RSpec.describe "User chat preferences", type: :system, js: true do context "as an admin on another user's preferences" do fab!(:current_user) { Fabricate(:admin) } - fab!(:user_1) { Fabricate(:admin) } + fab!(:user_1) { Fabricate(:user) } before { sign_in(current_user) }