Skip to content
Snippets Groups Projects
Commit 76aad9b7 authored by Vinnie Okada's avatar Vinnie Okada
Browse files

Upgrade to Rails 4.1.9

Make the following changes to deal with new behavior in Rails 4.1.2:

* Use nested resources to avoid slashes in arguments to path helpers.
parent 5725b6da
No related branches found
No related tags found
1 merge request!8686add "Uplaod" and "Replace" functionality
Showing
with 119 additions and 83 deletions
Loading
Loading
@@ -53,6 +53,7 @@ v 7.8.0 (unreleased)
- Show assignees in merge request index page (Kelvin Mutuma)
- Link head panel titles to relevant root page.
- Allow users that signed up via OAuth to set their password in order to use Git over HTTP(S).
- Upgrade Rails gem to version 4.1.9.
 
v 7.7.2
- Update GitLab Shell to version 2.4.2 that fixes a bug when developers can push to protected branch
Loading
Loading
Loading
Loading
@@ -3,31 +3,31 @@ GEM
specs:
RedCloth (4.2.9)
ace-rails-ap (2.0.1)
actionmailer (4.1.1)
actionpack (= 4.1.1)
actionview (= 4.1.1)
mail (~> 2.5.4)
actionpack (4.1.1)
actionview (= 4.1.1)
activesupport (= 4.1.1)
actionmailer (4.1.9)
actionpack (= 4.1.9)
actionview (= 4.1.9)
mail (~> 2.5, >= 2.5.4)
actionpack (4.1.9)
actionview (= 4.1.9)
activesupport (= 4.1.9)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
actionview (4.1.1)
activesupport (= 4.1.1)
actionview (4.1.9)
activesupport (= 4.1.9)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.1)
activesupport (= 4.1.1)
activemodel (4.1.9)
activesupport (= 4.1.9)
builder (~> 3.1)
activerecord (4.1.1)
activemodel (= 4.1.1)
activesupport (= 4.1.1)
activerecord (4.1.9)
activemodel (= 4.1.9)
activesupport (= 4.1.9)
arel (~> 5.0.0)
activeresource (4.0.0)
activemodel (~> 4.0)
activesupport (~> 4.0)
rails-observers (~> 0.1.1)
activesupport (4.1.1)
activesupport (4.1.9)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
Loading
Loading
@@ -303,9 +303,8 @@ GEM
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.4)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mail (2.6.3)
mime-types (>= 1.16, < 3)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.6.1)
Loading
Loading
@@ -372,7 +371,6 @@ GEM
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
polyglot (0.3.4)
posix-spawn (0.3.9)
powerpack (0.0.9)
pry (0.9.12.4)
Loading
Loading
@@ -403,30 +401,30 @@ GEM
rack (>= 1.1)
rack-protection (1.5.1)
rack
rack-test (0.6.2)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.1.1)
actionmailer (= 4.1.1)
actionpack (= 4.1.1)
actionview (= 4.1.1)
activemodel (= 4.1.1)
activerecord (= 4.1.1)
activesupport (= 4.1.1)
rails (4.1.9)
actionmailer (= 4.1.9)
actionpack (= 4.1.9)
actionview (= 4.1.9)
activemodel (= 4.1.9)
activerecord (= 4.1.9)
activesupport (= 4.1.9)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.1)
railties (= 4.1.9)
sprockets-rails (~> 2.0)
rails-observers (0.1.2)
activemodel (~> 4.0)
rails_autolink (1.1.6)
rails (> 3.1)
railties (4.1.1)
actionpack (= 4.1.1)
activesupport (= 4.1.1)
railties (4.1.9)
actionpack (= 4.1.9)
activesupport (= 4.1.9)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.0.0)
raindrops (0.13.0)
rake (10.3.2)
rake (10.4.2)
raphael-rails (2.1.2)
rb-fsevent (0.9.3)
rb-inotify (0.9.2)
Loading
Loading
@@ -553,10 +551,10 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.1.3)
sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
sprockets (>= 2.8, < 4.0)
stamp (0.5.0)
state_machine (1.2.0)
stringex (2.5.2)
Loading
Loading
@@ -587,9 +585,6 @@ GEM
multi_json (~> 1.7)
twitter-stream (~> 0.1)
tins (0.13.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (2.0.0)
coffee-rails
twitter-stream (0.1.16)
Loading
Loading
Loading
Loading
@@ -25,13 +25,16 @@ class Admin::ProjectsController < Admin::ApplicationController
def transfer
::Projects::TransferService.new(@project, current_user, params.dup).execute
 
redirect_to [:admin, @project.reload]
@project.reload
redirect_to admin_namespace_project_path(@project.namespace, @project)
end
 
protected
 
def project
@project = Project.find_with_namespace(params[:id])
@project = Project.find_with_namespace(
[params[:namespace_id], '/', params[:id]].join('')
)
@project || render_404
end
 
Loading
Loading
Loading
Loading
@@ -93,6 +93,7 @@ class ApplicationController < ActionController::Base
 
def project
unless @project
namespace = params[:namespace_id]
id = params[:project_id] || params[:id]
 
# Redirect from
Loading
Loading
@@ -104,7 +105,7 @@ class ApplicationController < ActionController::Base
redirect_to request.original_url.gsub(/\.git\Z/, '') and return
end
 
@project = Project.find_with_namespace(id)
@project = Project.find_with_namespace("#{namespace}/#{id}")
 
if @project and can?(current_user, :read_project, @project)
@project
Loading
Loading
@@ -121,7 +122,8 @@ class ApplicationController < ActionController::Base
 
def repository
@repository ||= project.repository
rescue Grit::NoSuchPathError
rescue Grit::NoSuchPathError(e)
log_exception(e)
nil
end
 
Loading
Loading
Loading
Loading
@@ -8,7 +8,8 @@ class Projects::ApplicationController < ApplicationController
# for non-signed users
if !current_user
id = params[:project_id] || params[:id]
@project = Project.find_with_namespace(id)
project_with_namespace = "#{params[:namespace_id]}/#{id}"
@project = Project.find_with_namespace(project_with_namespace)
 
return if @project && @project.public?
end
Loading
Loading
@@ -26,7 +27,10 @@ class Projects::ApplicationController < ApplicationController
 
def require_branch_head
unless @repository.branch_names.include?(@ref)
redirect_to project_tree_path(@project, @ref), notice: "This action is not allowed unless you are on top of a branch"
redirect_to(
namespace_project_tree_path(@project.namespace, @project, @ref),
notice: "This action is not allowed unless you are on top of a branch"
)
end
end
end
Loading
Loading
@@ -24,6 +24,6 @@ class Projects::AvatarsController < Projects::ApplicationController
@project.save
@project.reset_events_cache
 
redirect_to edit_project_path(@project)
redirect_to edit_namespace_project_path(@project.namespace, @project)
end
end
Loading
Loading
@@ -25,7 +25,7 @@ class Projects::BlobController < Projects::ApplicationController
 
if result[:status] == :success
flash[:notice] = "Your changes have been successfully committed"
redirect_to project_blob_path(@project, File.join(@ref, file_path))
redirect_to namespace_project_blob_path(@project.namespace, @project, File.join(@ref, file_path))
else
flash[:alert] = result[:message]
render :new
Loading
Loading
@@ -70,7 +70,8 @@ class Projects::BlobController < Projects::ApplicationController
 
if result[:status] == :success
flash[:notice] = "Your changes have been successfully committed"
redirect_to project_tree_path(@project, @ref)
redirect_to namespace_project_tree_path(@project.namespace, @project,
@ref)
else
flash[:alert] = result[:message]
render :show
Loading
Loading
@@ -102,7 +103,7 @@ class Projects::BlobController < Projects::ApplicationController
else
if tree = @repository.tree(@commit.id, @path)
if tree.entries.any?
redirect_to project_tree_path(@project, File.join(@ref, @path)) and return
redirect_to namespace_project_tree_path(@project.namespace, @project, File.join(@ref, @path)) and return
end
end
 
Loading
Loading
@@ -128,10 +129,10 @@ class Projects::BlobController < Projects::ApplicationController
def after_edit_path
@after_edit_path ||=
if from_merge_request
diffs_project_merge_request_path(from_merge_request.target_project, from_merge_request) +
diffs_namespace_project_merge_request_path(from_merge_request.target_project.namespace, from_merge_request.target_project, from_merge_request) +
"#file-path-#{hexdigest(@path)}"
else
project_blob_path(@project, @id)
namespace_project_blob_path(@project.namespace, @project, @id)
end
end
 
Loading
Loading
Loading
Loading
@@ -24,7 +24,8 @@ class Projects::BranchesController < Projects::ApplicationController
 
if result[:status] == :success
@branch = result[:branch]
redirect_to project_tree_path(@project, @branch.name)
redirect_to namespace_project_tree_path(@project.namespace, @project,
@branch.name)
else
@error = result[:message]
render action: 'new'
Loading
Loading
@@ -36,7 +37,10 @@ class Projects::BranchesController < Projects::ApplicationController
@branch_name = params[:id]
 
respond_to do |format|
format.html { redirect_to project_branches_path(@project) }
format.html do
redirect_to namespace_project_branches_path(@project.namespace,
@project)
end
format.js
end
end
Loading
Loading
Loading
Loading
@@ -25,6 +25,7 @@ class Projects::CompareController < Projects::ApplicationController
end
 
def create
redirect_to project_compare_path(@project, params[:from], params[:to])
redirect_to namespace_project_compare_path(@project.namespace, @project,
params[:from], params[:to])
end
end
Loading
Loading
@@ -25,7 +25,8 @@ class Projects::DeployKeysController < Projects::ApplicationController
@key = DeployKey.new(deploy_key_params)
 
if @key.valid? && @project.deploy_keys << @key
redirect_to project_deploy_keys_path(@project)
redirect_to namespace_project_deploy_keys_path(@project.namespace,
@project)
else
render "new"
end
Loading
Loading
@@ -44,13 +45,15 @@ class Projects::DeployKeysController < Projects::ApplicationController
def enable
@project.deploy_keys << available_keys.find(params[:id])
 
redirect_to project_deploy_keys_path(@project)
redirect_to namespace_project_deploy_keys_path(@project.namespace,
@project)
end
 
def disable
@project.deploy_keys_projects.where(deploy_key_id: params[:id]).last.destroy
 
redirect_to project_deploy_keys_path(@project)
redirect_to namespace_project_deploy_keys_path(@project.namespace,
@project)
end
 
protected
Loading
Loading
Loading
Loading
@@ -9,11 +9,14 @@ class Projects::ForksController < Projects::ApplicationController
end
 
def create
namespace = Namespace.find(params[:namespace_id])
namespace = Namespace.find(params[:namespace_key])
@forked_project = ::Projects::ForkService.new(project, current_user, namespace: namespace).execute
 
if @forked_project.saved? && @forked_project.forked?
redirect_to(@forked_project, notice: 'Project was successfully forked.')
redirect_to(
namespace_project_path(@forked_project.namespace, @forked_project),
notice: 'Project was successfully forked.'
)
else
@title = 'Fork project'
render :error
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@ class Projects::HooksController < Projects::ApplicationController
@hook.save
 
if @hook.valid?
redirect_to project_hooks_path(@project)
redirect_to namespace_project_hooks_path(@project.namespace, @project)
else
@hooks = @project.hooks.select(&:persisted?)
render :index
Loading
Loading
@@ -43,7 +43,7 @@ class Projects::HooksController < Projects::ApplicationController
def destroy
hook.destroy
 
redirect_to project_hooks_path(@project)
redirect_to namespace_project_hooks_path(@project.namespace, @project)
end
 
private
Loading
Loading
Loading
Loading
@@ -20,7 +20,7 @@ class Projects::ImportsController < Projects::ApplicationController
end
end
 
redirect_to project_import_path(@project)
redirect_to namespace_project_import_path(@project.namespace, @project)
end
 
def show
Loading
Loading
@@ -28,7 +28,8 @@ class Projects::ImportsController < Projects::ApplicationController
if @project.import_finished?
redirect_to(@project) and return
else
redirect_to new_project_import_path(@project) and return
redirect_to new_namespace_project_import_path(@project.namespace,
@project) && return
end
end
end
Loading
Loading
@@ -37,13 +38,14 @@ class Projects::ImportsController < Projects::ApplicationController
 
def require_no_repo
if @project.repository_exists?
redirect_to(@project) and return
redirect_to(namespace_project_path(@project.namespace, @project)) and return
end
end
 
def redirect_if_progress
if @project.import_in_progress?
redirect_to project_import_path(@project) and return
redirect_to namespace_project_import_path(@project.namespace, @project) &&
return
end
end
end
Loading
Loading
@@ -60,7 +60,8 @@ class Projects::IssuesController < Projects::ApplicationController
respond_to do |format|
format.html do
if @issue.valid?
redirect_to project_issue_path(@project, @issue)
redirect_to namespace_project_issue_path(@project.namespace,
@project, @issue)
else
render :new
end
Loading
Loading
@@ -78,7 +79,7 @@ class Projects::IssuesController < Projects::ApplicationController
format.js
format.html do
if @issue.valid?
redirect_to [@project, @issue]
redirect_to [@project.namespace, @project, @issue]
else
render :edit
end
Loading
Loading
@@ -128,7 +129,8 @@ class Projects::IssuesController < Projects::ApplicationController
issue = @project.issues.find_by(id: params[:id])
 
if issue
redirect_to project_issue_path(@project, issue)
redirect_to namespace_project_issue_path(@project.namespace, @project,
issue)
return
else
raise ActiveRecord::RecordNotFound.new
Loading
Loading
Loading
Loading
@@ -18,7 +18,7 @@ class Projects::LabelsController < Projects::ApplicationController
@label = @project.labels.create(label_params)
 
if @label.valid?
redirect_to project_labels_path(@project)
redirect_to namespace_project_labels_path(@project.namespace, @project)
else
render 'new'
end
Loading
Loading
@@ -29,7 +29,7 @@ class Projects::LabelsController < Projects::ApplicationController
 
def update
if @label.update_attributes(label_params)
redirect_to project_labels_path(@project)
redirect_to namespace_project_labels_path(@project.namespace, @project)
else
render 'edit'
end
Loading
Loading
@@ -39,11 +39,12 @@ class Projects::LabelsController < Projects::ApplicationController
Gitlab::IssuesLabels.generate(@project)
 
if params[:redirect] == 'issues'
redirect_to project_issues_path(@project)
redirect_to namespace_project_issues_path(@project.namespace, @project)
elsif params[:redirect] == 'merge_requests'
redirect_to project_merge_requests_path(@project)
redirect_to namespace_project_merge_requests_path(@project.namespace,
@project)
else
redirect_to project_labels_path(@project)
redirect_to namespace_project_labels_path(@project.namespace, @project)
end
end
 
Loading
Loading
@@ -51,7 +52,10 @@ class Projects::LabelsController < Projects::ApplicationController
@label.destroy
 
respond_to do |format|
format.html { redirect_to project_labels_path(@project), notice: 'Label was removed' }
format.html do
redirect_to(namespace_project_labels_path(@project.namespace, @project),
notice: 'Label was removed')
end
format.js
end
end
Loading
Loading
Loading
Loading
@@ -78,7 +78,12 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request = MergeRequests::CreateService.new(project, current_user, merge_request_params).execute
 
if @merge_request.valid?
redirect_to project_merge_request_path(@merge_request.target_project, @merge_request), notice: 'Merge request was successfully created.'
redirect_to(
namespace_project_merge_request_path(@merge_request.target_project.namespace,
@merge_request.target_project,
@merge_request),
notice: 'Merge request was successfully created.'
)
else
@source_project = @merge_request.source_project
@target_project = @merge_request.target_project
Loading
Loading
@@ -93,7 +98,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
respond_to do |format|
format.js
format.html do
redirect_to [@merge_request.target_project, @merge_request], notice: 'Merge request was successfully updated.'
redirect_to([@merge_request.target_project.namespace.becomes(Namespace),
@merge_request.target_project, @merge_request],
notice: 'Merge request was successfully updated.')
end
end
else
Loading
Loading
Loading
Loading
@@ -40,7 +40,8 @@ class Projects::MilestonesController < Projects::ApplicationController
@milestone = Milestones::CreateService.new(project, current_user, milestone_params).execute
 
if @milestone.save
redirect_to project_milestone_path(@project, @milestone)
redirect_to namespace_project_milestone_path(@project.namespace,
@project, @milestone)
else
render "new"
end
Loading
Loading
@@ -67,7 +68,7 @@ class Projects::MilestonesController < Projects::ApplicationController
@milestone.destroy
 
respond_to do |format|
format.html { redirect_to project_milestones_path }
format.html { redirect_to namespace_project_milestones_path }
format.js { render nothing: true }
end
end
Loading
Loading
Loading
Loading
@@ -12,7 +12,8 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
 
def create
@project.protected_branches.create(protected_branch_params)
redirect_to project_protected_branches_path(@project)
redirect_to namespace_project_protected_branches_path(@project.namespace,
@project)
end
 
def update
Loading
Loading
@@ -37,7 +38,7 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
@project.protected_branches.find(params[:id]).destroy
 
respond_to do |format|
format.html { redirect_to project_protected_branches_path }
format.html { redirect_to namespace_project_protected_branches_path }
format.js { render nothing: true }
end
end
Loading
Loading
Loading
Loading
@@ -9,13 +9,15 @@ class Projects::RefsController < Projects::ApplicationController
respond_to do |format|
format.html do
new_path = if params[:destination] == "tree"
project_tree_path(@project, (@id))
namespace_project_tree_path(@project.namespace, @project,
(@id))
elsif params[:destination] == "blob"
project_blob_path(@project, (@id))
namespace_project_blob_path(@project.namespace, @project,
(@id))
elsif params[:destination] == "graph"
project_network_path(@project, @id, @options)
namespace_project_network_path(@project.namespace, @project, @id, @options)
else
project_commits_path(@project, @id)
namespace_project_commits_path(@project.namespace, @project, @id)
end
 
redirect_to new_path
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ class Projects::RepositoriesController < Projects::ApplicationController
def create
@project.create_repository
 
redirect_to @project
redirect_to namespace_project_path(@project.namespace, @project)
end
 
def archive
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment