FIX: redirect to login page for anonymous user when profiles are hidden
This commit is contained in:
parent
5c39c8f24b
commit
ea26c56631
|
@ -36,7 +36,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
raise Discourse::InvalidAccess if SiteSetting.hide_user_profiles_from_public && !current_user
|
||||
return redirect_to path('/login') if SiteSetting.hide_user_profiles_from_public && !current_user
|
||||
|
||||
@user = fetch_user_from_params(
|
||||
{ include_inactive: current_user.try(:staff?) },
|
||||
|
|
|
@ -13,10 +13,10 @@ describe UsersController do
|
|||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it "raises an error for anon when profiles are hidden" do
|
||||
it "should redirect to login page for anonymous user when profiles are hidden" do
|
||||
SiteSetting.hide_user_profiles_from_public = true
|
||||
xhr :get, :show, username: user.username, format: :json
|
||||
expect(response).not_to be_success
|
||||
expect(response).to redirect_to '/login'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue