FIX: correctly allows admin to visit a user chat's preferences page (#19619)
This commit is contained in:
parent
03d32f26bb
commit
df11457d56
|
@ -1,4 +1,4 @@
|
||||||
{{#if (or this.model.can_chat this.model.admin)}}
|
{{#if (or this.model.can_chat this.currentUser.admin)}}
|
||||||
<LinkTo @route="preferences.chat">
|
<LinkTo @route="preferences.chat">
|
||||||
{{i18n "chat.title_capitalized"}}
|
{{i18n "chat.title_capitalized"}}
|
||||||
</LinkTo>
|
</LinkTo>
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default class PreferencesChatRoute extends RestrictedUserRoute {
|
||||||
showFooter = true;
|
showFooter = true;
|
||||||
|
|
||||||
setupController(controller, user) {
|
setupController(controller, user) {
|
||||||
if (!user?.can_chat && !user.admin) {
|
if (!user?.can_chat && !this.currentUser.admin) {
|
||||||
return this.transitionTo(`discovery.${defaultHomepage()}`);
|
return this.transitionTo(`discovery.${defaultHomepage()}`);
|
||||||
}
|
}
|
||||||
controller.set("model", user);
|
controller.set("model", user);
|
||||||
|
|
|
@ -34,7 +34,7 @@ RSpec.describe "User chat preferences", type: :system, js: true do
|
||||||
|
|
||||||
context "as an admin on another user's preferences" do
|
context "as an admin on another user's preferences" do
|
||||||
fab!(:current_user) { Fabricate(:admin) }
|
fab!(:current_user) { Fabricate(:admin) }
|
||||||
fab!(:user_1) { Fabricate(:admin) }
|
fab!(:user_1) { Fabricate(:user) }
|
||||||
|
|
||||||
before { sign_in(current_user) }
|
before { sign_in(current_user) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue