Commit e986605d authored by azul's avatar azul

fix: make all not founds look the same

There should be no difference between
* a non existing context
* a hidden group
* a hidden user
parent 5f23d56a
......@@ -13,7 +13,7 @@ class Group::BaseController < ApplicationController
def fetch_group
# group might be preloaded by DispatchController
@group ||= Group.find_by_name(params[:group_id] || params[:id])
raise_not_found if @group.nil? || !policy(@group).show?
raise_not_found(:page) if @group.nil? || !policy(@group).show?
@membership = Group::Membership.where(group: @group, user: current_user).
first_or_initialize
end
......
......@@ -10,7 +10,7 @@ class Person::BaseController < ApplicationController
def fetch_person
# person might be preloaded by DispatchController
@user ||= User.where(login: (params[:person_id] || params[:id])).first
raise_not_found unless @user && policy(@user).show?
raise_not_found(:page) unless @user && policy(@user).show?
end
def setup_context
......
......@@ -19,12 +19,13 @@ class ErrorFlowTest < IntegrationTest
fill_in 'password', with: 'blue'
click_button :sign_in.t
assert_equal '/me/pages', current_path
assert_no_content 'Login Required'
end
def test_not_found_but_exists
visit '/private_group'
assert_content 'Not Found'
assert_content 'Page Not Found'
assert_no_content 'private_group'
assert_equal '/private_group', current_path
fill_in 'login', with: 'blue'
......@@ -36,7 +37,7 @@ class ErrorFlowTest < IntegrationTest
def test_not_found
visit '/asdfswera'
assert_content 'Not Found'
assert_content 'Page Not Found'
assert_equal '/asdfswera', current_path
fill_in 'login', with: 'blue'
fill_in 'password', with: 'blue'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment