Patch #820 ยป fix_NoMethodError_in_SearchController.diff
| test/functional/search_controller_test.rb (working copy) | ||
|---|---|---|
|
assert_equal 2, results.size
|
||
|
end
|
||
|
|
||
|
def test_search_with_invalid_project_id
|
||
|
get :index, :id => 195, :q => 'recipe'
|
||
|
assert_response 404
|
||
|
assert_nil assigns(:results)
|
||
|
end
|
||
|
def test_quick_jump_to_issue
|
||
|
# issue of a public project
|
||
|
get :index, :q => "3"
|
||
| app/controllers/application.rb (working copy) | ||
|---|---|---|
|
# make sure that the user is a member of the project (or admin) if project is private
|
||
|
# used as a before_filter for actions that do not require any particular permission on the project
|
||
|
def check_project_privacy
|
||
|
unless @project.active?
|
||
|
if @project && @project.active?
|
||
|
return true if @project.is_public? || User.current.member_of?(@project) || User.current.admin?
|
||
|
User.current.logged? ? render_403 : require_login
|
||
|
else
|
||
|
@project = nil
|
||
|
render_404
|
||
|
return false
|
||
|
end
|
||
|
return true if @project.is_public? || User.current.member_of?(@project) || User.current.admin?
|
||
|
User.current.logged? ? render_403 : require_login
|
||
|
end
|
||
|
# store current uri in session.
|
||
| app/controllers/search_controller.rb (working copy) | ||
|---|---|---|
|
def find_project
|
||
|
@project = Project.find(params[:id])
|
||
|
rescue ActiveRecord::RecordNotFound
|
||
|
render_404
|
||
|
end
|
||
|
end
|
||