Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq

This commit is contained in:
Marin Jankovski 2016-03-14 11:40:17 +01:00
commit 90c10f4dab
5 changed files with 20 additions and 23 deletions

View file

@ -30,6 +30,7 @@ v 8.6.0 (unreleased)
- Add main language of a project in the list of projects (Tiago Botelho)
- Add ability to show archived projects on dashboard, explore and group pages
- Move group activity to separate page
- Continue parameters are checked to ensure redirection goes to the same instance
v 8.5.5
- Ensure removing a project removes associated Todo entries

View file

@ -0,0 +1,13 @@
module ContinueParams
extend ActiveSupport::Concern
def continue_params
continue_params = params[:continue]
return nil unless continue_params
continue_params = continue_params.permit(:to, :notice, :notice_now)
return unless continue_params[:to] && continue_params[:to].start_with?('/')
continue_params
end
end

View file

@ -1,4 +1,6 @@
class Projects::ForksController < Projects::ApplicationController
include ContinueParams
# Authorize
before_action :require_non_empty_project
before_action :authorize_download_code!
@ -53,15 +55,4 @@ class Projects::ForksController < Projects::ApplicationController
render :error
end
end
private
def continue_params
continue_params = params[:continue]
if continue_params
continue_params.permit(:to, :notice, :notice_now)
else
nil
end
end
end

View file

@ -1,4 +1,6 @@
class Projects::ImportsController < Projects::ApplicationController
include ContinueParams
# Authorize
before_action :authorize_admin_project!
before_action :require_no_repo, only: [:new, :create]
@ -44,16 +46,6 @@ class Projects::ImportsController < Projects::ApplicationController
private
def continue_params
continue_params = params[:continue]
if continue_params
continue_params.permit(:to, :notice, :notice_now)
else
nil
end
end
def finished_notice
if @project.forked?
'The project was successfully forked.'

View file

@ -19,7 +19,7 @@ describe Projects::ImportsController do
end
it 'sets flash.now if params is present' do
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: { notice_now: 'Started' }
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: { to: '/', notice_now: 'Started' }
expect(flash.now[:notice]).to eq 'Started'
end
@ -45,7 +45,7 @@ describe Projects::ImportsController do
end
it 'sets flash.now if params is present' do
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: { notice_now: 'In progress' }
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: { to: '/', notice_now: 'In progress' }
expect(flash.now[:notice]).to eq 'In progress'
end