Commit 29f5fe11 authored by Douwe Maan's avatar Douwe Maan

Create and use project path helpers that only need a project, no namespace

parent bc506785
...@@ -40,14 +40,14 @@ class Admin::ProjectsController < Admin::ApplicationController ...@@ -40,14 +40,14 @@ class Admin::ProjectsController < Admin::ApplicationController
::Projects::TransferService.new(@project, current_user, params.dup).execute(namespace) ::Projects::TransferService.new(@project, current_user, params.dup).execute(namespace)
@project.reload @project.reload
redirect_to admin_namespace_project_path(@project.namespace, @project) redirect_to admin_project_path(@project)
end end
def repository_check def repository_check
RepositoryCheck::SingleRepositoryWorker.perform_async(@project.id) RepositoryCheck::SingleRepositoryWorker.perform_async(@project.id)
redirect_to( redirect_to(
admin_namespace_project_path(@project.namespace, @project), admin_project_path(@project),
notice: 'Repository check was triggered.' notice: 'Repository check was triggered.'
) )
end end
......
...@@ -78,8 +78,7 @@ module CreatesCommit ...@@ -78,8 +78,7 @@ module CreatesCommit
end end
def new_merge_request_path def new_merge_request_path
namespace_project_new_merge_request_path( project_new_merge_request_path(
@project_to_commit_into.namespace,
@project_to_commit_into, @project_to_commit_into,
merge_request: { merge_request: {
source_project_id: @project_to_commit_into.id, source_project_id: @project_to_commit_into.id,
...@@ -91,7 +90,7 @@ module CreatesCommit ...@@ -91,7 +90,7 @@ module CreatesCommit
end end
def existing_merge_request_path def existing_merge_request_path
namespace_project_merge_request_path(@project.namespace, @project, @merge_request) project_merge_request_path(@project, @merge_request)
end end
def merge_request_exists? def merge_request_exists?
......
...@@ -45,7 +45,7 @@ module MilestoneActions ...@@ -45,7 +45,7 @@ module MilestoneActions
def milestone_redirect_path def milestone_redirect_path
if @project if @project
namespace_project_milestone_path(@project.namespace, @project, @milestone) project_milestone_path(@project, @milestone)
elsif @group elsif @group
group_milestone_path(@group, @milestone.safe_title, title: @milestone.title) group_milestone_path(@group, @milestone.safe_title, title: @milestone.title)
else else
......
...@@ -2,6 +2,6 @@ module RepositorySettingsRedirect ...@@ -2,6 +2,6 @@ module RepositorySettingsRedirect
extend ActiveSupport::Concern extend ActiveSupport::Concern
def redirect_to_repository_settings(project) def redirect_to_repository_settings(project)
redirect_to namespace_project_settings_repository_path(project.namespace, project) redirect_to project_settings_repository_path(project)
end end
end end
...@@ -9,9 +9,9 @@ module SpammableActions ...@@ -9,9 +9,9 @@ module SpammableActions
def mark_as_spam def mark_as_spam
if SpamService.new(spammable).mark_as_spam! if SpamService.new(spammable).mark_as_spam!
redirect_to spammable, notice: "#{spammable.spammable_entity_type.titlecase} was submitted to Akismet successfully." redirect_to spammable_path, notice: "#{spammable.spammable_entity_type.titlecase} was submitted to Akismet successfully."
else else
redirect_to spammable, alert: 'Error with Akismet. Please check the logs for more info.' redirect_to spammable_path, alert: 'Error with Akismet. Please check the logs for more info.'
end end
end end
...@@ -25,7 +25,7 @@ module SpammableActions ...@@ -25,7 +25,7 @@ module SpammableActions
def recaptcha_check_with_fallback(&fallback) def recaptcha_check_with_fallback(&fallback)
if spammable.valid? if spammable.valid?
redirect_to spammable redirect_to spammable_path
elsif render_recaptcha? elsif render_recaptcha?
ensure_spam_config_loaded! ensure_spam_config_loaded!
...@@ -56,6 +56,10 @@ module SpammableActions ...@@ -56,6 +56,10 @@ module SpammableActions
raise NotImplementedError, "#{self.class} does not implement #{__method__}" raise NotImplementedError, "#{self.class} does not implement #{__method__}"
end end
def spammable_path
raise NotImplementedError, "#{self.class} does not implement #{__method__}"
end
def authorize_submit_spammable! def authorize_submit_spammable!
access_denied! unless current_user.admin? access_denied! unless current_user.admin?
end end
......
...@@ -10,7 +10,7 @@ module EE ...@@ -10,7 +10,7 @@ module EE
def export_csv def export_csv
ExportCsvWorker.perform_async(current_user.id, project.id, filter_params) ExportCsvWorker.perform_async(current_user.id, project.id, filter_params)
index_path = namespace_project_issues_path(project.namespace, project) index_path = project_issues_path(project)
redirect_to(index_path, notice: "Your CSV export has started. It will be emailed to #{current_user.notification_email} when complete.") redirect_to(index_path, notice: "Your CSV export has started. It will be emailed to #{current_user.notification_email} when complete.")
end end
......
...@@ -63,7 +63,7 @@ class InvitesController < ApplicationController ...@@ -63,7 +63,7 @@ class InvitesController < ApplicationController
when Project when Project
project = member.source project = member.source
label = "project #{project.name_with_namespace}" label = "project #{project.name_with_namespace}"
path = namespace_project_path(project.namespace, project) path = project_path(project)
when Group when Group
group = member.source group = member.source
label = "group #{group.name}" label = "group #{group.name}"
......
...@@ -76,13 +76,13 @@ class Projects::ApplicationController < ApplicationController ...@@ -76,13 +76,13 @@ class Projects::ApplicationController < ApplicationController
def require_non_empty_project def require_non_empty_project
# Be sure to return status code 303 to avoid a double DELETE: # Be sure to return status code 303 to avoid a double DELETE:
# http://api.rubyonrails.org/classes/ActionController/Redirecting.html # http://api.rubyonrails.org/classes/ActionController/Redirecting.html
redirect_to namespace_project_path(@project.namespace, @project), status: 303 if @project.empty_repo? redirect_to project_path(@project), status: 303 if @project.empty_repo?
end end
def require_branch_head def require_branch_head
unless @repository.branch_exists?(@ref) unless @repository.branch_exists?(@ref)
redirect_to( redirect_to(
namespace_project_tree_path(@project.namespace, @project, @ref), project_tree_path(@project, @ref),
notice: "This action is not allowed unless you are on a branch" notice: "This action is not allowed unless you are on a branch"
) )
end end
......
...@@ -46,7 +46,7 @@ class Projects::ArtifactsController < Projects::ApplicationController ...@@ -46,7 +46,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
def keep def keep
build.keep_artifacts! build.keep_artifacts!
redirect_to namespace_project_job_path(project.namespace, project, build) redirect_to project_job_path(project, build)
end end
def latest_succeeded def latest_succeeded
......
...@@ -27,9 +27,9 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -27,9 +27,9 @@ class Projects::BlobController < Projects::ApplicationController
def create def create
create_commit(Files::CreateService, success_notice: "The file has been successfully created.", create_commit(Files::CreateService, success_notice: "The file has been successfully created.",
success_path: -> { namespace_project_blob_path(@project.namespace, @project, File.join(@branch_name, @file_path)) }, success_path: -> { project_blob_path(@project, File.join(@branch_name, @file_path)) },
failure_view: :new, failure_view: :new,
failure_path: namespace_project_new_blob_path(@project.namespace, @project, @ref)) failure_path: project_new_blob_path(@project, @ref))
end end
def show def show
...@@ -63,7 +63,7 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -63,7 +63,7 @@ class Projects::BlobController < Projects::ApplicationController
@path = params[:file_path] if params[:file_path].present? @path = params[:file_path] if params[:file_path].present?
create_commit(Files::UpdateService, success_path: -> { after_edit_path }, create_commit(Files::UpdateService, success_path: -> { after_edit_path },
failure_view: :edit, failure_view: :edit,
failure_path: namespace_project_blob_path(@project.namespace, @project, @id)) failure_path: project_blob_path(@project, @id))
rescue Files::UpdateService::FileChangedError rescue Files::UpdateService::FileChangedError
@conflict = true @conflict = true
...@@ -83,9 +83,9 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -83,9 +83,9 @@ class Projects::BlobController < Projects::ApplicationController
def destroy def destroy
create_commit(Files::DeleteService, success_notice: "The file has been successfully deleted.", create_commit(Files::DeleteService, success_notice: "The file has been successfully deleted.",
success_path: -> { namespace_project_tree_path(@project.namespace, @project, @branch_name) }, success_path: -> { project_tree_path(@project, @branch_name) },
failure_view: :show, failure_view: :show,
failure_path: namespace_project_blob_path(@project.namespace, @project, @id)) failure_path: project_blob_path(@project, @id))
end end
def diff def diff
...@@ -118,7 +118,7 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -118,7 +118,7 @@ class Projects::BlobController < Projects::ApplicationController
else else
if tree = @repository.tree(@commit.id, @path) if tree = @repository.tree(@commit.id, @path)
if tree.entries.any? if tree.entries.any?
return redirect_to namespace_project_tree_path(@project.namespace, @project, File.join(@ref, @path)) return redirect_to project_tree_path(@project, File.join(@ref, @path))
end end
end end
...@@ -143,10 +143,10 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -143,10 +143,10 @@ class Projects::BlobController < Projects::ApplicationController
def after_edit_path def after_edit_path
from_merge_request = MergeRequestsFinder.new(current_user, project_id: @project.id).execute.find_by(iid: params[:from_merge_request_iid]) from_merge_request = MergeRequestsFinder.new(current_user, project_id: @project.id).execute.find_by(iid: params[:from_merge_request_iid])
if from_merge_request && @branch_name == @ref if from_merge_request && @branch_name == @ref
diffs_namespace_project_merge_request_path(from_merge_request.target_project.namespace, from_merge_request.target_project, from_merge_request) + diffs_project_merge_request_path(from_merge_request.target_project, from_merge_request) +
"##{hexdigest(@path)}" "##{hexdigest(@path)}"
else else
namespace_project_blob_path(@project.namespace, @project, File.join(@branch_name, @path)) project_blob_path(@project, File.join(@branch_name, @path))
end end
end end
......
...@@ -60,7 +60,7 @@ class Projects::BoardsController < Projects::ApplicationController ...@@ -60,7 +60,7 @@ class Projects::BoardsController < Projects::ApplicationController
service.execute(@board) service.execute(@board)
respond_to do |format| respond_to do |format|
format.html { redirect_to namespace_project_boards_path(@project.namespace, @project), status: 302 } format.html { redirect_to project_boards_path(@project), status: 302 }
end end
end end
......
...@@ -52,7 +52,7 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -52,7 +52,7 @@ class Projects::BranchesController < Projects::ApplicationController
redirect_to url_to_autodeploy_setup(project, branch_name), redirect_to url_to_autodeploy_setup(project, branch_name),
notice: view_context.autodeploy_flash_notice(branch_name) notice: view_context.autodeploy_flash_notice(branch_name)
else else
redirect_to namespace_project_tree_path(@project.namespace, @project, branch_name) redirect_to project_tree_path(@project, branch_name)
end end
else else
@error = result[:message] @error = result[:message]
...@@ -62,7 +62,7 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -62,7 +62,7 @@ class Projects::BranchesController < Projects::ApplicationController
format.json do format.json do
if result[:status] == :success if result[:status] == :success
render json: { name: branch_name, url: namespace_project_tree_url(@project.namespace, @project, branch_name) } render json: { name: branch_name, url: project_tree_url(@project, branch_name) }
else else
render json: result[:messsage], status: :unprocessable_entity render json: result[:messsage], status: :unprocessable_entity
end end
...@@ -79,7 +79,7 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -79,7 +79,7 @@ class Projects::BranchesController < Projects::ApplicationController
flash_type = result[:status] == :error ? :alert : :notice flash_type = result[:status] == :error ? :alert : :notice
flash[flash_type] = result[:message] flash[flash_type] = result[:message]
redirect_to namespace_project_branches_path(@project.namespace, @project), status: 303 redirect_to project_branches_path(@project), status: 303
end end
format.js { render nothing: true, status: result[:return_code] } format.js { render nothing: true, status: result[:return_code] }
...@@ -90,7 +90,7 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -90,7 +90,7 @@ class Projects::BranchesController < Projects::ApplicationController
def destroy_all_merged def destroy_all_merged
DeleteMergedBranchesService.new(@project, current_user).async_execute DeleteMergedBranchesService.new(@project, current_user).async_execute
redirect_to namespace_project_branches_path(@project.namespace, @project), redirect_to project_branches_path(@project),
notice: 'Merged branches are being deleted. This can take some time depending on the number of branches. Please refresh the page to see changes.' notice: 'Merged branches are being deleted. This can take some time depending on the number of branches. Please refresh the page to see changes.'
end end
...@@ -106,8 +106,7 @@ class Projects::BranchesController < Projects::ApplicationController ...@@ -106,8 +106,7 @@ class Projects::BranchesController < Projects::ApplicationController
end end
def url_to_autodeploy_setup(project, branch_name) def url_to_autodeploy_setup(project, branch_name)
namespace_project_new_blob_path( project_new_blob_path(
project.namespace,
project, project,
branch_name, branch_name,
file_name: '.gitlab-ci.yml', file_name: '.gitlab-ci.yml',
......
...@@ -7,23 +7,23 @@ class Projects::BuildArtifactsController < Projects::ApplicationController ...@@ -7,23 +7,23 @@ class Projects::BuildArtifactsController < Projects::ApplicationController
before_action :validate_artifacts! before_action :validate_artifacts!
def download def download
redirect_to download_namespace_project_job_artifacts_path(project.namespace, project, job) redirect_to download_project_job_artifacts_path(project, job)
end end
def browse def browse
redirect_to browse_namespace_project_job_artifacts_path(project.namespace, project, job, path: params[:path]) redirect_to browse_project_job_artifacts_path(project, job, path: params[:path])
end end
def file def file
redirect_to file_namespace_project_job_artifacts_path(project.namespace, project, job, path: params[:path]) redirect_to file_project_job_artifacts_path(project, job, path: params[:path])
end end
def raw def raw
redirect_to raw_namespace_project_job_artifacts_path(project.namespace, project, job, path: params[:path]) redirect_to raw_project_job_artifacts_path(project, job, path: params[:path])
end end
def latest_succeeded def latest_succeeded
redirect_to latest_succeeded_namespace_project_artifacts_path(project.namespace, project, job, ref_name_and_path: params[:ref_name_and_path], job: params[:job]) redirect_to latest_succeeded_project_artifacts_path(project, job, ref_name_and_path: params[:ref_name_and_path], job: params[:job])
end end
private private
......
...@@ -2,15 +2,15 @@ class Projects::BuildsController < Projects::ApplicationController ...@@ -2,15 +2,15 @@ class Projects::BuildsController < Projects::ApplicationController
before_action :authorize_read_build! before_action :authorize_read_build!
def index def index
redirect_to namespace_project_jobs_path(project.namespace, project) redirect_to project_jobs_path(project)
end end
def show def show
redirect_to namespace_project_job_path(project.namespace, project, job) redirect_to project_job_path(project, job)
end end
def raw def raw
redirect_to raw_namespace_project_job_path(project.namespace, project, job) redirect_to raw_project_job_path(project, job)
end end
private private
......
...@@ -80,16 +80,16 @@ class Projects::CommitController < Projects::ApplicationController ...@@ -80,16 +80,16 @@ class Projects::CommitController < Projects::ApplicationController
end end
def successful_change_path def successful_change_path
referenced_merge_request_url || namespace_project_commits_url(@project.namespace, @project, @branch_name) referenced_merge_request_url || project_commits_url(@project, @branch_name)
end end
def failed_change_path def failed_change_path
referenced_merge_request_url || namespace_project_commit_url(@project.namespace, @project, params[:id]) referenced_merge_request_url || project_commit_url(@project, params[:id])
end end
def referenced_merge_request_url def referenced_merge_request_url
if merge_request = @commit.merged_merge_request(current_user) if merge_request = @commit.merged_merge_request(current_user)
namespace_project_merge_request_url(merge_request.target_project.namespace, merge_request.target_project, merge_request) project_merge_request_url(merge_request.target_project, merge_request)
end end
end end
......
...@@ -31,9 +31,9 @@ class Projects::CompareController < Projects::ApplicationController ...@@ -31,9 +31,9 @@ class Projects::CompareController < Projects::ApplicationController
from: params[:from].presence, from: params[:from].presence,
to: params[:to].presence to: params[:to].presence
} }
redirect_to namespace_project_compare_index_path(@project.namespace, @project, from_to_vars) redirect_to project_compare_index_path(@project, from_to_vars)
else else
redirect_to namespace_project_compare_path(@project.namespace, @project, redirect_to project_compare_path(@project,
params[:from], params[:to]) params[:from], params[:to])
end end
end end
......
...@@ -64,7 +64,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -64,7 +64,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
@environment = project.environments.create(environment_params) @environment = project.environments.create(environment_params)
if @environment.persisted? if @environment.persisted?
redirect_to namespace_project_environment_path(project.namespace, project, @environment) redirect_to project_environment_path(project, @environment)
else else
render :new render :new
end end
...@@ -72,7 +72,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -72,7 +72,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
def update def update
if @environment.update(environment_params) if @environment.update(environment_params)
redirect_to namespace_project_environment_path(project.namespace, project, @environment) redirect_to project_environment_path(project, @environment)
else else
render :edit render :edit
end end
...@@ -87,7 +87,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -87,7 +87,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
if stop_action if stop_action
polymorphic_url([project.namespace.becomes(Namespace), project, stop_action]) polymorphic_url([project.namespace.becomes(Namespace), project, stop_action])
else else
namespace_project_environment_url(project.namespace, project, @environment) project_environment_url(project, @environment)
end end
respond_to do |format| respond_to do |format|
......
...@@ -44,12 +44,12 @@ class Projects::ForksController < Projects::ApplicationController ...@@ -44,12 +44,12 @@ class Projects::ForksController < Projects::ApplicationController
if @forked_project.saved? && @forked_project.forked? if @forked_project.saved? && @forked_project.forked?
if @forked_project.import_in_progress? if @forked_project.import_in_progress?
redirect_to namespace_project_import_path(@forked_project.namespace, @forked_project, continue: continue_params) redirect_to project_import_path(@forked_project, continue: continue_params)
else else
if continue_params if continue_params
redirect_to continue_params[:to], notice: continue_params[:notice] redirect_to continue_params[:to], notice: continue_params[:notice]
else else
redirect_to namespace_project_path(@forked_project.namespace, @forked_project), notice: "The project '#{@forked_project.name}' was successfully forked." redirect_to project_path(@forked_project), notice: "The project '#{@forked_project.name}' was successfully forked."
end end
end end
else else
......
...@@ -29,7 +29,7 @@ class Projects::GraphsController < Projects::ApplicationController ...@@ -29,7 +29,7 @@ class Projects::GraphsController < Projects::ApplicationController
end end
def ci def ci
redirect_to charts_namespace_project_pipelines_path(@project.namespace, @project) redirect_to charts_project_pipelines_path(@project)
end end
private private
......
...@@ -22,7 +22,7 @@ class Projects::GroupLinksController < Projects::ApplicationController ...@@ -22,7 +22,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
flash[:alert] = 'Please select a group.' flash[:alert] = 'Please select a group.'
end end
redirect_to namespace_project_settings_members_path(project.namespace, project) redirect_to project_settings_members_path(project)
end end
def update def update
...@@ -36,7 +36,7 @@ class Projects::GroupLinksController < Projects::ApplicationController ...@@ -36,7 +36,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_to namespace_project_settings_members_path(project.namespace, project), status: 302 redirect_to project_settings_members_path(project), status: 302
end end
format.js { head :ok } format.js { head :ok }
end end
......
...@@ -18,7 +18,7 @@ class Projects::HookLogsController < Projects::ApplicationController ...@@ -18,7 +18,7 @@ class Projects::HookLogsController < Projects::ApplicationController
set_hook_execution_notice(status, message) set_hook_execution_notice(status, message)
redirect_to edit_namespace_project_hook_path(@project.namespace, @project, @hook) redirect_to edit_project_hook_path(@project, @hook)
end end
private private
......
...@@ -17,7 +17,7 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -17,7 +17,7 @@ class Projects::HooksController < Projects::ApplicationController
@hooks = @project.hooks.select(&:persisted?) @hooks = @project.hooks.select(&:persisted?)
flash[:alert] = @hook.errors.full_messages.join.html_safe flash[:alert] = @hook.errors.full_messages.join.html_safe
end end
redirect_to namespace_project_settings_integrations_path(@project.namespace, @project) redirect_to project_settings_integrations_path(@project)
end end
def edit def edit
...@@ -26,7 +26,7 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -26,7 +26,7 @@ class Projects::HooksController < Projects::ApplicationController
def update def update
if hook.update_attributes(hook_params) if hook.update_attributes(hook_params)
flash[:notice] = 'Hook was successfully updated.' flash[:notice] = 'Hook was successfully updated.'
redirect_to namespace_project_settings_integrations_path(@project.namespace, @project) redirect_to project_settings_integrations_path(@project)
else else
render 'edit' render 'edit'
end end
...@@ -47,7 +47,7 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -47,7 +47,7 @@ class Projects::HooksController < Projects::ApplicationController
def destroy def destroy
hook.destroy hook.destroy
redirect_to namespace_project_settings_integrations_path(@project.namespace, @project), status: 302 redirect_to project_settings_integrations_path(@project), status: 302
end end
private private
......
...@@ -15,7 +15,7 @@ class Projects::ImportsController < Projects::ApplicationController ...@@ -15,7 +15,7 @@ class Projects::ImportsController < Projects::ApplicationController
@project.reload.import_schedule @project.reload.import_schedule
end end
redirect_to namespace_project_import_path(@project.namespace, @project) redirect_to project_import_path(@project)
end end
def show def show
...@@ -23,10 +23,10 @@ class Projects::ImportsController < Projects::ApplicationController ...@@ -23,10 +23,10 @@ class Projects::ImportsController < Projects::ApplicationController
if continue_params if continue_params
redirect_to continue_params[:to], notice: continue_params[:notice] redirect_to continue_params[:to], notice: continue_params[:notice]
else else
redirect_to namespace_project_path(@project.namespace, @project), notice: finished_notice redirect_to project_path(@project), notice: finished_notice
end end
elsif @project.import_failed? elsif @project.import_failed?
redirect_to new_namespace_project_import_path(@project.namespace, @project) redirect_to new_project_import_path(@project)
else else
if continue_params && continue_params[:notice_now] if continue_params && continue_params[:notice_now]
flash.now[:notice] = continue_params[:notice_now] flash.now[:notice] = continue_params[:notice_now]
...@@ -48,19 +48,19 @@ class Projects::ImportsController < Projects::ApplicationController ...@@ -48,19 +48,19 @@ class Projects::ImportsController < Projects::ApplicationController
def require_no_repo def require_no_repo
if @project.repository_exists? if @project.repository_exists?
redirect_to namespace_project_path(@project.namespace, @project) redirect_to project_path(@project)
end end
end end
def redirect_if_progress def redirect_if_progress
if @project.import_in_progress? if @project.import_in_progress?
redirect_to namespace_project_import_path(@project.namespace, @project) redirect_to project_import_path(@project)
end end
end end
def redirect_if_no_import def redirect_if_no_import
if @project.repository_exists? && @project.no_import? if @project.repository_exists? && @project.no_import?
redirect_to namespace_project_path(@project.namespace, @project) redirect_to project_path(@project)
end end
end end
......
...@@ -241,6 +241,10 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -241,6 +241,10 @@ class Projects::IssuesController < Projects::ApplicationController
alias_method :awardable, :issue alias_method :awardable, :issue
alias_method :spammable, :issue alias_method :spammable, :issue
def spammable_path
project_issue_path(@project, @issue)
end
def authorize_update_issue! def authorize_update_issue!
return render_404 unless can?(current_user, :update_issue, @issue) return render_404 unless can?(current_user, :update_issue, @issue)
end end
......
...@@ -38,7 +38,7 @@ class Projects::JobsController < Projects::ApplicationController ...@@ -38,7 +38,7 @@ class Projects::JobsController < Projects::ApplicationController
build.cancel if can?(current_user, :update_build, build) build.cancel if can?(current_user, :update_build, build)
end end
redirect_to namespace_project_jobs_path(project.namespace, project) redirect_to project_jobs_path(project)
end end
def show def show
...@@ -108,7 +108,7 @@ class Projects::JobsController < Projects::ApplicationController ...@@ -108,7 +108,7 @@ class Projects::JobsController < Projects::ApplicationController
def erase def erase
if @build.erase(erased_by: current_user) if @build.erase(erased_by: current_user)
redirect_to namespace_project_job_path(project.namespace, project, @build), redirect_to project_job_path(project, @build),
notice: "Build has been successfully erased!" notice: "Build has been successfully erased!"
else else
respond_422 respond_422
...@@ -137,6 +137,6 @@ class Projects::JobsController < Projects::ApplicationController ...@@ -137,6 +137,6 @@ class Projects::JobsController < Projects::ApplicationController
end end
def build_path(build) def build_path(build)
namespace_project_job_path(build.project.namespace, build.project, build) project_job_path(build.project, build)
end end
end end
...@@ -33,7 +33,7 @@ class Projects::LabelsController < Projects::ApplicationController ...@@ -33,7 +33,7 @@ class Projects::LabelsController < Projects::ApplicationController
if @label.valid? if @label.valid?
respond_to do |format| respond_to do |format|
format.html { redirect_to namespace_project_labels_path(@project.namespace, @project) } format.html { redirect_to project_labels_path(@project) }
format.json { render json: @label } format.json { render json: @label }
end end
else else
...@@ -51,7 +51,7 @@ class Projects::LabelsController < Projects::ApplicationController ...@@ -51,7 +51,7 @@ class Projects::LabelsController < Projects::ApplicationController
@label = Labels::UpdateService.new(label_params).execute(@label) @label = Labels::UpdateService.new(label_params).execute(@label)
if @label.valid? if @label.valid?
redirect_to namespace_project_labels_path(@project.namespace, @project) redirect_to project_labels_path(@project)
else else
render :edit render :edit
end end
...@@ -61,12 +61,11 @@ class Projects::LabelsController < Projects::ApplicationController ...@@ -61,12 +61,11 @@ class Projects::LabelsController < Projects::ApplicationController
Gitlab::IssuesLabels.generate(@project) Gitlab::IssuesLabels.generate(@project)
if params[:redirect] == 'issues' if params[:redirect] == 'issues'
redirect_to namespace_project_issues_path(@project.namespace, @project) redirect_to project_issues_path(@project)
elsif params[:redirect] == 'merge_requests' elsif params[:redirect] == 'merge_requests'
redirect_to namespace_project_merge_requests_path(@project.namespace, redirect_to project_merge_requests_path(@project)
@project)
else else
redirect_to namespace_project_labels_path(@project.namespace, @project) redirect_to project_labels_path(@project)
end end
end end
...@@ -74,7 +73,7 @@ class Projects::LabelsController < Projects::ApplicationController ...@@ -74,7 +73,7 @@ class Projects::LabelsController < Projects::ApplicationController
@label.destroy @label.destroy
@labels = find_labels @labels = find_labels
redirect_to namespace_project_labels_path(@project.namespace, @project), redirect_to project_labels_path(@project),
status: 302, status: 302,
notice: 'Label was removed' notice: 'Label was removed'
end end
...@@ -114,7 +113,7 @@ class Projects::LabelsController < Projects::ApplicationController ...@@ -114,7 +113,7 @@ class Projects::LabelsController < Projects::ApplicationController
return render_404 unless promote_service.execute(@label) return render_404 unless promote_service.execute(@label)
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_to(namespace_project_labels_path(@project.namespace, @project), redirect_to(project_labels_path(@project),
notice: 'Label was promoted to a Group Label') notice: 'Label was promoted to a Group Label')
end end
format.js format.js
...@@ -125,7 +124,7 @@ class Projects::LabelsController < Projects::ApplicationController ...@@ -125,7 +124,7 @@ class Projects::LabelsController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_to(namespace_project_labels_path(@project.namespace, @project), redirect_to(project_labels_path(@project),
notice: 'Failed to promote label due to internal error. Please contact administrators.') notice: 'Failed to promote label due to internal error. Please contact administrators.')
end end
format.js format.js
......
...@@ -16,12 +16,10 @@ class Projects::MattermostsController < Projects::ApplicationController ...@@ -16,12 +16,10 @@ class Projects::MattermostsController < Projects::ApplicationController
if result if result
flash[:notice] = 'This service is now configured' flash[:notice] = 'This service is now configured'
redirect_to edit_namespace_project_service_path( redirect_to edit_project_service_path(@project, service)
@project.namespace, @project, service)
else else
flash[:alert] = message || 'Failed to configure service' flash[:alert] = message || 'Failed to configure service'
redirect_to new_namespace_project_mattermost_path( redirect_to new_project_mattermost_path(@project)
@project.namespace, @project)
end end
end end
......
...@@ -52,7 +52,7 @@ class Projects::MergeRequests::ConflictsController < Projects::MergeRequests::Ap ...@@ -52,7 +52,7 @@ class Projects::MergeRequests::ConflictsController < Projects::MergeRequests::Ap
flash[:notice] = 'All merge conflicts were resolved. The merge request can now be merged.' flash[:notice] = 'All merge conflicts were resolved. The merge request can now be merged.'
render json: { redirect_to: namespace_project_merge_request_url(@project.namespace, @project, @merge_request, resolved_conflicts: true) } render json: { redirect_to: project_merge_request_url(@project, @merge_request, resolved_conflicts: true) }
rescue Gitlab::Conflict::ResolutionError => e rescue Gitlab::Conflict::ResolutionError => e
render status: :bad_request, json: { message: e.message } render status: :bad_request, json: { message: e.message }
end end
......
...@@ -214,21 +214,18 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo ...@@ -214,21 +214,18 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
stop_url = stop_url =
if environment.stop_action? && can?(current_user, :create_deployment, environment) if environment.stop_action? && can?(current_user, :create_deployment, environment)
stop_namespace_project_environment_path(project.namespace, project, environment) stop_project_environment_path(project, environment)
end end
metrics_url = metrics_url =
if can?(current_user, :read_environment, environment) && environment.has_metrics? if can?(current_user, :read_environment, environment) && environment.has_metrics?
metrics_namespace_project_environment_deployment_path(environment.project.namespace, metrics_project_environment_deployment_path(environment.project, environment, deployment)
environment.project,
environment,
deployment)
end end
{ {
id: environment.id, id: environment.id,
name: environment.name, name: environment.name,
url: namespace_project_environment_path(project.namespace, project, environment), url: project_environment_path(project, environment),
metrics_url: metrics_url, metrics_url: metrics_url,
stop_url: stop_url, stop_url: stop_url,
external_url: environment.external_url, external_url: environment.external_url,
......
...@@ -55,8 +55,7 @@ class Projects::MilestonesController < Projects::ApplicationController ...@@ -55,8 +55,7 @@ class Projects::MilestonesController < Projects::ApplicationController
@milestone = Milestones::CreateService.new(project, current_user, milestone_params).execute @milestone = Milestones::CreateService.new(project, current_user, milestone_params).execute
if @milestone.save if @milestone.save
redirect_to namespace_project_milestone_path(@project.namespace, redirect_to project_milestone_path(@project, @milestone)
@project, @milestone)
else else
render "new" render "new"
end end
...@@ -69,8 +68,7 @@ class Projects::MilestonesController < Projects::ApplicationController ...@@ -69,8 +68,7 @@ class Projects::MilestonesController < Projects::ApplicationController
format.js format.js
format.html do format.html do
if @milestone.valid? if @milestone.valid?
redirect_to namespace_project_milestone_path(@project.namespace, redirect_to project_milestone_path(@project, @milestone)
@project, @milestone)
else else
render :edit render :edit
end end
......
...@@ -8,8 +8,8 @@ class Projects::NetworkController < Projects::ApplicationController ...@@ -8,8 +8,8 @@ class Projects::NetworkController < Projects::ApplicationController
before_action :assign_commit before_action :assign_commit
def show def show
@url = namespace_project_network_path(@project.namespace, @project, @ref, @options.merge(format: :json)) @url = project_network_path(@project, @ref, @options.merge(format: :json))
@commit_url = namespace_project_commit_path(@project.namespace, @project, 'ae45ca32').gsub("ae45ca32", "%s") @commit_url = project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")
respond_to do |format| respond_to do |format|
format.html do format.html do
......
...@@ -15,7 +15,7 @@ class Projects::PagesController < Projects::ApplicationController ...@@ -15,7 +15,7 @@ class Projects::PagesController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_to namespace_project_pages_path(@project.namespace, @project), redirect_to project_pages_path(@project),
status: 302, status: 302,
notice: 'Pages were removed' notice: 'Pages were removed'
end end
......
...@@ -16,7 +16,7 @@ class Projects::PagesDomainsController < Projects::ApplicationController ...@@ -16,7 +16,7 @@ class Projects::PagesDomainsController < Projects::ApplicationController
@domain = @project.pages_domains.create(pages_domain_params) @domain = @project.pages_domains.create(pages_domain_params)
if @domain.valid? if @domain.valid?
redirect_to namespace_project_pages_path(@project.namespace, @project) redirect_to project_pages_path(@project)
else else
render 'new' render 'new'
end end
...@@ -27,7 +27,7 @@ class Projects::PagesDomainsController < Projects::ApplicationController ...@@ -27,7 +27,7 @@ class Projects::PagesDomainsController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_to namespace_project_pages_path(@project.namespace, @project), redirect_to project_pages_path(@project),
status: 302, status: 302,
notice: 'Domain was removed' notice: 'Domain was removed'
end end
......
...@@ -36,7 +36,7 @@ class Projects::PathLocksController < Projects::ApplicationController ...@@ -36,7 +36,7 @@ class Projects::PathLocksController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_to namespace_project_locks_path(@project.namespace, @project), status: 302 redirect_to project_locks_path(@project), status: 302
end end
format.js format.js
end end
......
...@@ -34,7 +34,7 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController ...@@ -34,7 +34,7 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
def update def update
if schedule.update(schedule_params) if schedule.update(schedule_params)
redirect_to namespace_project_pipeline_schedules_path(@project.namespace.becomes(Namespace), @project) redirect_to project_pipeline_schedules_path(@project)
else else
render :edit render :edit
end end
......
...@@ -60,7 +60,7 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -60,7 +60,7 @@ class Projects::PipelinesController < Projects::ApplicationController
.execute(:web, ignore_skip_ci: true, save_on_errors: false) .execute(:web, ignore_skip_ci: true, save_on_errors: false)
if @pipeline.persisted? if @pipeline.persisted?
redirect_to namespace_project_pipeline_path(project.namespace, project, @pipeline) redirect_to project_pipeline_path(project, @pipeline)
else else
render 'new' render 'new'
end end
...@@ -111,7 +111,7 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -111,7 +111,7 @@ class Projects::PipelinesController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_back_or_default default: namespace_project_pipelines_path(project.namespace, project) redirect_back_or_default default: project_pipelines_path(project)
end end
format.json { head :no_content } format.json { head :no_content }
...@@ -123,7 +123,7 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -123,7 +123,7 @@ class Projects::PipelinesController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_back_or_default default: namespace_project_pipelines_path(project.namespace, project) redirect_back_or_default default: project_pipelines_path(project)
end end
format.json { head :no_content } format.json { head :no_content }
......
...@@ -2,13 +2,13 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController ...@@ -2,13 +2,13 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
before_action :authorize_admin_pipeline! before_action :authorize_admin_pipeline!
def show def show
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project, params: params) redirect_to project_settings_ci_cd_path(@project, params: params)
end end
def update def update
if @project.update_attributes(update_params) if @project.update_attributes(update_params)
flash[:notice] = "Pipelines settings for '#{@project.name}' were successfully updated." flash[:notice] = "Pipelines settings for '#{@project.name}' were successfully updated."
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project) redirect_to project_settings_ci_cd_path(@project)
else else
render 'show' render 'show'
end end
......
...@@ -7,7 +7,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController ...@@ -7,7 +7,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController
def index def index
sort = params[:sort].presence || sort_value_name sort = params[:sort].presence || sort_value_name
redirect_to namespace_project_settings_members_path(@project.namespace, @project, sort: sort) redirect_to project_settings_members_path(@project, sort: sort)
end end
def update def update
...@@ -23,7 +23,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController ...@@ -23,7 +23,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController
end end
def resend_invite def resend_invite
redirect_path = namespace_project_settings_members_path(@project.namespace, @project) redirect_path = project_settings_members_path(@project)
@project_member = @project.project_members.find(params[:id]) @project_member = @project.project_members.find(params[:id])
...@@ -46,7 +46,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController ...@@ -46,7 +46,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController
return render_404 return render_404
end end
redirect_to(namespace_project_settings_members_path(project.namespace, project), redirect_to(project_settings_members_path(project),
notice: notice) notice: notice)
end end
......
...@@ -7,7 +7,7 @@ module Projects ...@@ -7,7 +7,7 @@ module Projects
@merge_access_level = @protected_branch.merge_access_levels.find(params[:id]) @merge_access_level = @protected_branch.merge_access_levels.find(params[:id])
@merge_access_level.destroy @merge_access_level.destroy
redirect_to namespace_project_protected_branch_path(@project.namespace, @project, @protected_branch), redirect_to project_protected_branch_path(@project, @protected_branch),
status: 302, status: 302,
notice: "Successfully deleted. #{@merge_access_level.humanize} will not be able to merge into this protected branch." notice: "Successfully deleted. #{@merge_access_level.humanize} will not be able to merge into this protected branch."
end end
......
...@@ -7,7 +7,7 @@ module Projects ...@@ -7,7 +7,7 @@ module Projects
@push_access_level = @protected_branch.push_access_levels.find(params[:id]) @push_access_level = @protected_branch.push_access_levels.find(params[:id])
@push_access_level.destroy @push_access_level.destroy
redirect_to namespace_project_protected_branch_path(@project.namespace, @project, @protected_branch), redirect_to project_protected_branch_path(@project, @protected_branch),
status: 302, status: 302,
notice: "Successfully deleted. #{@push_access_level.humanize} will not be able to push to this protected branch." notice: "Successfully deleted. #{@push_access_level.humanize} will not be able to push to this protected branch."
end end
......
...@@ -7,7 +7,7 @@ module Projects ...@@ -7,7 +7,7 @@ module Projects
@create_access_level = @protected_tag.create_access_levels.find(params[:id]) @create_access_level = @protected_tag.create_access_levels.find(params[:id])
@create_access_level.destroy @create_access_level.destroy
redirect_to namespace_project_protected_tag_path(@project.namespace, @project, @protected_tag), redirect_to project_protected_tag_path(@project, @protected_tag),
status: 302, status: 302,
notice: "Successfully deleted. #{@create_access_level.humanize} will not be able to create this protected tag." notice: "Successfully deleted. #{@create_access_level.humanize} will not be able to create this protected tag."
end end
......
...@@ -14,21 +14,21 @@ class Projects::RefsController < Projects::ApplicationController ...@@ -14,21 +14,21 @@ class Projects::RefsController < Projects::ApplicationController
new_path = new_path =
case params[:destination] case params[:destination]
when "tree" when "tree"
namespace_project_tree_path(@project.namespace, @project, @id) project_tree_path(@project, @id)
when "blob" when "blob"
namespace_project_blob_path(@project.namespace, @project, @id) project_blob_path(@project, @id)
when "graph" when "graph"
namespace_project_network_path(@project.namespace, @project, @id, @options) project_network_path(@project, @id, @options)
when "graphs" when "graphs"
namespace_project_graph_path(@project.namespace, @project, @id) project_graph_path(@project, @id)
when "find_file" when "find_file"
namespace_project_find_file_path(@project.namespace, @project, @id) project_find_file_path(@project, @id)
when "graphs_commits" when "graphs_commits"
commits_namespace_project_graph_path(@project.namespace, @project, @id) commits_project_graph_path(@project, @id)
when "badges" when "badges"
namespace_project_pipelines_settings_path(@project.namespace, @project, ref: @id) project_pipelines_settings_path(@project, ref: @id)
else else
namespace_project_commits_path(@project.namespace, @project, @id) project_commits_path(@project, @id)
end end
redirect_to new_path redirect_to new_path
...@@ -69,7 +69,7 @@ class Projects::RefsController < Projects::ApplicationController ...@@ -69,7 +69,7 @@ class Projects::RefsController < Projects::ApplicationController
offset = @offset + @limit offset = @offset + @limit
if contents.size > offset if contents.size > offset
@more_log_url = logs_file_namespace_project_ref_path(@project.namespace, @project, @ref, @path || '', offset: offset) @more_log_url = logs_file_project_ref_path(@project, @ref, @path || '', offset: offset)
end end
respond_to do |format| respond_to do |format|
......
...@@ -10,11 +10,11 @@ module Projects ...@@ -10,11 +10,11 @@ module Projects
def destroy def destroy
if image.destroy if image.destroy
redirect_to project_container_registry_path(@project), redirect_to project_container_registry_index_path(@project),
status: 302, status: 302,
notice: 'Image repository has been removed successfully!' notice: 'Image repository has been removed successfully!'
else else
redirect_to project_container_registry_path(@project), redirect_to project_container_registry_index_path(@project),
status: 302, status: 302,
alert: 'Failed to remove image repository!' alert: 'Failed to remove image repository!'
end end
......
...@@ -5,11 +5,11 @@ module Projects ...@@ -5,11 +5,11 @@ module Projects
def destroy def destroy
if tag.delete if tag.delete
redirect_to project_container_registry_path(@project), redirect_to project_container_registry_index_path(@project),
status: 302, status: 302,
notice: 'Registry tag has been removed successfully!' notice: 'Registry tag has been removed successfully!'
else else
redirect_to project_container_registry_path(@project), redirect_to project_container_registry_index_path(@project),
status: 302, status: 302,
alert: 'Failed to remove registry tag!' alert: 'Failed to remove registry tag!'
end end
......
...@@ -19,7 +19,7 @@ class Projects::ReleasesController < Projects::ApplicationController ...@@ -19,7 +19,7 @@ class Projects::ReleasesController < Projects::ApplicationController
release.destroy release.destroy
end end
redirect_to namespace_project_tag_path(@project.namespace, @project, @tag.name) redirect_to project_tag_path(@project, @tag.name)
end end
private private
......
...@@ -5,7 +5,7 @@ class Projects::RunnersController < Projects::ApplicationController ...@@ -5,7 +5,7 @@ class Projects::RunnersController < Projects::ApplicationController
layout 'project_settings' layout 'project_settings'
def index def index
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project) redirect_to project_settings_ci_cd_path(@project)
end end
def edit def edit
...@@ -49,7 +49,7 @@ class Projects::RunnersController < Projects::ApplicationController ...@@ -49,7 +49,7 @@ class Projects::RunnersController < Projects::ApplicationController
def toggle_shared_runners def toggle_shared_runners
project.toggle!(:shared_runners_enabled) project.toggle!(:shared_runners_enabled)
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project) redirect_to project_settings_ci_cd_path(@project)
end end
protected protected
......
...@@ -15,7 +15,7 @@ class Projects::ServicesController < Projects::ApplicationController ...@@ -15,7 +15,7 @@ class Projects::ServicesController < Projects::ApplicationController
def update def update
if @service.save(context: :manual_change) if @service.save(context: :manual_change)
redirect_to(namespace_project_settings_integrations_path(@project.namespace, @project), notice: success_message) redirect_to(project_settings_integrations_path(@project), notice: success_message)
else else
render 'edit' render 'edit'
end end
......
...@@ -30,7 +30,7 @@ class Projects::SnippetsController < Projects::ApplicationController ...@@ -30,7 +30,7 @@ class Projects::SnippetsController < Projects::ApplicationController
).execute ).execute
@snippets = @snippets.page(params[:page]) @snippets = @snippets.page(params[:page])
if @snippets.out_of_range? && @snippets.total_pages != 0 if @snippets.out_of_range? && @snippets.total_pages != 0
redirect_to namespace_project_snippets_path(page: @snippets.total_pages) redirect_to project_snippets_path(@project, page: @snippets.total_pages)
end end
end end
...@@ -79,7 +79,7 @@ class Projects::SnippetsController < Projects::ApplicationController ...@@ -79,7 +79,7 @@ class Projects::SnippetsController < Projects::ApplicationController
@snippet.destroy @snippet.destroy
redirect_to namespace_project_snippets_path(@project.namespace, @project), status: 302 redirect_to project_snippets_path(@project), status: 302
end end
protected protected
...@@ -90,6 +90,10 @@ class Projects::SnippetsController < Projects::ApplicationController ...@@ -90,6 +90,10 @@ class Projects::SnippetsController < Projects::ApplicationController
alias_method :awardable, :snippet alias_method :awardable, :snippet
alias_method :spammable, :snippet alias_method :spammable, :snippet
def spammable_path
project_snippet_path(@project, @snippet)
end
def authorize_read_project_snippet! def authorize_read_project_snippet!
return render_404 unless can?(current_user, :read_project_snippet, @snippet) return render_404 unless can?(current_user, :read_project_snippet, @snippet)
end end
......
...@@ -35,7 +35,7 @@ class Projects::TagsController < Projects::ApplicationController ...@@ -35,7 +35,7 @@ class Projects::TagsController < Projects::ApplicationController
if result[:status] == :success if result[:status] == :success
@tag = result[:tag] @tag = result[:tag]
redirect_to namespace_project_tag_path(@project.namespace, @project, @tag.name) redirect_to project_tag_path(@project, @tag.name)
else else
@error = result[:message] @error = result[:message]
@message = params[:message] @message = params[:message]
...@@ -50,7 +50,7 @@ class Projects::TagsController < Projects::ApplicationController ...@@ -50,7 +50,7 @@ class Projects::TagsController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
if result[:status] == :success if result[:status] == :success
format.html do format.html do
redirect_to namespace_project_tags_path(@project.namespace, @project), status: 303 redirect_to project_tags_path(@project), status: 303
end end
format.js format.js
...@@ -58,7 +58,7 @@ class Projects::TagsController < Projects::ApplicationController ...@@ -58,7 +58,7 @@ class Projects::TagsController < Projects::ApplicationController
@error = result[:message] @error = result[:message]
format.html do format.html do
redirect_to namespace_project_tags_path(@project.namespace, @project), redirect_to project_tags_path(@project),
alert: @error, status: 303 alert: @error, status: 303
end end
......
...@@ -16,7 +16,7 @@ class Projects::TreeController < Projects::ApplicationController ...@@ -16,7 +16,7 @@ class Projects::TreeController < Projects::ApplicationController
if tree.entries.empty? if tree.entries.empty?
if @repository.blob_at(@commit.id, @path) if @repository.blob_at(@commit.id, @path)
return redirect_to( return redirect_to(
namespace_project_blob_path(@project.namespace, @project, project_blob_path(@project,
File.join(@ref, @path)) File.join(@ref, @path))
) )
elsif @path.present? elsif @path.present?
...@@ -37,8 +37,8 @@ class Projects::TreeController < Projects::ApplicationController ...@@ -37,8 +37,8 @@ class Projects::TreeController < Projects::ApplicationController
return render_404 unless @commit_params.values.all? return render_404 unless @commit_params.values.all?
create_commit(Files::CreateDirService, success_notice: "The directory has been successfully created.", create_commit(Files::CreateDirService, success_notice: "The directory has been successfully created.",
success_path: namespace_project_tree_path(@project.namespace, @project, File.join(@branch_name, @dir_name)), success_path: project_tree_path(@project, File.join(@branch_name, @dir_name)),
failure_path: namespace_project_tree_path(@project.namespace, @project, @ref)) failure_path: project_tree_path(@project, @ref))
end end
private private
......
...@@ -7,7 +7,7 @@ class Projects::TriggersController < Projects::ApplicationController ...@@ -7,7 +7,7 @@ class Projects::TriggersController < Projects::ApplicationController
layout 'project_settings' layout 'project_settings'
def index def index
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project) redirect_to project_settings_ci_cd_path(@project)
end end
def create def create
...@@ -19,7 +19,7 @@ class Projects::TriggersController < Projects::ApplicationController ...@@ -19,7 +19,7 @@ class Projects::TriggersController < Projects::ApplicationController
flash[:alert] = 'You could not create a new trigger.' flash[:alert] = 'You could not create a new trigger.'
end end
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project) redirect_to project_settings_ci_cd_path(@project)
end end
def take_ownership def take_ownership
...@@ -29,7 +29,7 @@ class Projects::TriggersController < Projects::ApplicationController ...@@ -29,7 +29,7 @@ class Projects::TriggersController < Projects::ApplicationController
flash[:alert] = 'You could not take ownership of trigger.' flash[:alert] = 'You could not take ownership of trigger.'
end end
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project) redirect_to project_settings_ci_cd_path(@project)
end end
def edit def edit
...@@ -37,7 +37,7 @@ class Projects::TriggersController < Projects::ApplicationController ...@@ -37,7 +37,7 @@ class Projects::TriggersController < Projects::ApplicationController
def update def update
if trigger.update(trigger_params) if trigger.update(trigger_params)
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project), notice: 'Trigger was successfully updated.' redirect_to project_settings_ci_cd_path(@project), notice: 'Trigger was successfully updated.'
else else
render action: "edit" render action: "edit"
end end
...@@ -50,7 +50,7 @@ class Projects::TriggersController < Projects::ApplicationController ...@@ -50,7 +50,7 @@ class Projects::TriggersController < Projects::ApplicationController
flash[:alert] = "Could not remove the trigger." flash[:alert] = "Could not remove the trigger."
end end
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project), status: 302 redirect_to project_settings_ci_cd_path(@project), status: 302
end end
private private
......
...@@ -6,7 +6,7 @@ class Projects::VariablesController < Projects::ApplicationController ...@@ -6,7 +6,7 @@ class Projects::VariablesController < Projects::ApplicationController
layout 'project_settings' layout 'project_settings'
def index def index
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project) redirect_to project_settings_ci_cd_path(@project)
end end
def show def show
...@@ -17,7 +17,7 @@ class Projects::VariablesController < Projects::ApplicationController ...@@ -17,7 +17,7 @@ class Projects::VariablesController < Projects::ApplicationController
@variable = @project.variables.find(params[:id]) @variable = @project.variables.find(params[:id])
if @variable.update_attributes(variable_params) if @variable.update_attributes(variable_params)
redirect_to namespace_project_variables_path(project.namespace, project), notice: 'Variable was successfully updated.' redirect_to project_variables_path(project), notice: 'Variable was successfully updated.'
else else
render action: "show" render action: "show"
end end
...@@ -28,7 +28,7 @@ class Projects::VariablesController < Projects::ApplicationController ...@@ -28,7 +28,7 @@ class Projects::VariablesController < Projects::ApplicationController
if @variable.save if @variable.save
flash[:notice] = 'Variables were successfully updated.' flash[:notice] = 'Variables were successfully updated.'
redirect_to namespace_project_settings_ci_cd_path(project.namespace, project) redirect_to project_settings_ci_cd_path(project)
else else
render "show" render "show"
end end
...@@ -38,7 +38,7 @@ class Projects::VariablesController < Projects::ApplicationController ...@@ -38,7 +38,7 @@ class Projects::VariablesController < Projects::ApplicationController
@key = @project.variables.find(params[:id]) @key = @project.variables.find(params[:id])
@key.destroy @key.destroy
redirect_to namespace_project_settings_ci_cd_path(project.namespace, project), redirect_to project_settings_ci_cd_path(project),
status: 302, status: 302,
notice: 'Variable was successfully removed.' notice: 'Variable was successfully removed.'
end end
......
...@@ -52,7 +52,7 @@ class Projects::WikisController < Projects::ApplicationController ...@@ -52,7 +52,7 @@ class Projects::WikisController < Projects::ApplicationController
Gitlab::Geo.notify_wiki_update(@project) if Gitlab::Geo.primary? Gitlab::Geo.notify_wiki_update(@project) if Gitlab::Geo.primary?
redirect_to( redirect_to(
namespace_project_wiki_path(@project.namespace, @project, @page), project_wiki_path(@project, @page),
notice: 'Wiki was successfully updated.' notice: 'Wiki was successfully updated.'
) )
else else
...@@ -67,7 +67,7 @@ class Projects::WikisController < Projects::ApplicationController ...@@ -67,7 +67,7 @@ class Projects::WikisController < Projects::ApplicationController
# Triggers repository update on secondary nodes when Geo is enabled # Triggers repository update on secondary nodes when Geo is enabled
Gitlab::Geo.notify_wiki_update(@project) if Gitlab::Geo.primary? Gitlab::Geo.notify_wiki_update(@project) if Gitlab::Geo.primary?
redirect_to( redirect_to(
namespace_project_wiki_path(@project.namespace, @project, @page), project_wiki_path(@project, @page),
notice: 'Wiki was successfully updated.' notice: 'Wiki was successfully updated.'
) )
else else
...@@ -80,7 +80,7 @@ class Projects::WikisController < Projects::ApplicationController ...@@ -80,7 +80,7 @@ class Projects::WikisController < Projects::ApplicationController
unless @page unless @page
redirect_to( redirect_to(
namespace_project_wiki_path(@project.namespace, @project, :home), project_wiki_path(@project, :home),
notice: "Page not found" notice: "Page not found"
) )
end end
...@@ -91,7 +91,7 @@ class Projects::WikisController < Projects::ApplicationController ...@@ -91,7 +91,7 @@ class Projects::WikisController < Projects::ApplicationController
WikiPages::DestroyService.new(@project, current_user).execute(@page) WikiPages::DestroyService.new(@project, current_user).execute(@page)
redirect_to namespace_project_wiki_path(@project.namespace, @project, :home), redirect_to project_wiki_path(@project, :home),
status: 302, status: 302,
notice: "Page was successfully deleted" notice: "Page was successfully deleted"
end end
......
...@@ -93,7 +93,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -93,7 +93,7 @@ class ProjectsController < Projects::ApplicationController
def show def show
# If we're importing while we do have a repository, we're simply updating the mirror. # If we're importing while we do have a repository, we're simply updating the mirror.
if @project.import_in_progress? && !@project.updating_mirror? if @project.import_in_progress? && !@project.updating_mirror?
redirect_to namespace_project_import_path(@project.namespace, @project) redirect_to project_import_path(@project)
return return
end end
......
...@@ -44,7 +44,7 @@ class SearchController < ApplicationController ...@@ -44,7 +44,7 @@ class SearchController < ApplicationController
query = params[:search].strip.downcase query = params[:search].strip.downcase
found_by_commit_sha = Commit.valid_hash?(query) && only_commit.sha.start_with?(query) found_by_commit_sha = Commit.valid_hash?(query) && only_commit.sha.start_with?(query)
redirect_to namespace_project_commit_path(@project.namespace, @project, only_commit) if found_by_commit_sha redirect_to project_commit_path(@project, only_commit) if found_by_commit_sha
end end
end end
end end
...@@ -107,6 +107,10 @@ class SnippetsController < ApplicationController ...@@ -107,6 +107,10 @@ class SnippetsController < ApplicationController
alias_method :awardable, :snippet alias_method :awardable, :snippet
alias_method :spammable, :snippet alias_method :spammable, :snippet
def spammable_path
snippet_path(@snippet)
end
def authorize_read_snippet! def authorize_read_snippet!
return if can?(current_user, :read_personal_snippet, @snippet) return if can?(current_user, :read_personal_snippet, @snippet)
......
...@@ -7,7 +7,7 @@ module AwardEmojiHelper ...@@ -7,7 +7,7 @@ module AwardEmojiHelper
if awardable.for_personal_snippet? if awardable.for_personal_snippet?
toggle_award_emoji_snippet_note_path(awardable.noteable, awardable) toggle_award_emoji_snippet_note_path(awardable.noteable, awardable)
else else
toggle_award_emoji_namespace_project_note_path(@project.namespace, @project, awardable.id) toggle_award_emoji_project_note_path(@project, awardable.id)
end end
else else
url_for([:toggle_award_emoji, @project.namespace.becomes(Namespace), @project, awardable]) url_for([:toggle_award_emoji, @project.namespace.becomes(Namespace), @project, awardable])
......
...@@ -9,7 +9,7 @@ module BlobHelper ...@@ -9,7 +9,7 @@ module BlobHelper
end end
def edit_path(project = @project, ref = @ref, path = @path, options = {}) def edit_path(project = @project, ref = @ref, path = @path, options = {})
namespace_project_edit_blob_path(project.namespace, project, project_edit_blob_path(project,
tree_join(ref, path), tree_join(ref, path),
options[:link_opts]) options[:link_opts])
end end
...@@ -33,7 +33,7 @@ module BlobHelper ...@@ -33,7 +33,7 @@ module BlobHelper
notice: edit_in_new_fork_notice, notice: edit_in_new_fork_notice,
notice_now: edit_in_new_fork_notice_now notice_now: edit_in_new_fork_notice_now
} }
fork_path = namespace_project_forks_path(project.namespace, project, namespace_key: current_user.namespace.id, continue: continue_params) fork_path = project_forks_path(project, namespace_key: current_user.namespace.id, continue: continue_params)
button_tag 'Edit', button_tag 'Edit',
class: "#{common_classes} js-edit-blob-link-fork-toggler", class: "#{common_classes} js-edit-blob-link-fork-toggler",
...@@ -62,7 +62,7 @@ module BlobHelper ...@@ -62,7 +62,7 @@ module BlobHelper
notice: edit_in_new_fork_notice + " Try to #{action} this file again.", notice: edit_in_new_fork_notice + " Try to #{action} this file again.",
notice_now: edit_in_new_fork_notice_now notice_now: edit_in_new_fork_notice_now
} }
fork_path = namespace_project_forks_path(project.namespace, project, namespace_key: current_user.namespace.id, continue: continue_params) fork_path = project_forks_path(project, namespace_key: current_user.namespace.id, continue: continue_params)
button_tag label, button_tag label,
class: "#{common_classes} js-edit-blob-link-fork-toggler", class: "#{common_classes} js-edit-blob-link-fork-toggler",
...@@ -120,15 +120,15 @@ module BlobHelper ...@@ -120,15 +120,15 @@ module BlobHelper
def blob_raw_url def blob_raw_url
if @build && @entry if @build && @entry
raw_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path: @entry.path) raw_project_job_artifacts_path(@project, @build, path: @entry.path)
elsif @snippet elsif @snippet
if @snippet.project_id if @snippet.project_id
raw_namespace_project_snippet_path(@project.namespace, @project, @snippet) raw_project_snippet_path(@project, @snippet)
else else
raw_snippet_path(@snippet) raw_snippet_path(@snippet)
end end
elsif @blob elsif @blob
namespace_project_raw_path(@project.namespace, @project, @id) project_raw_path(@project, @id)
end end
end end
...@@ -279,12 +279,12 @@ module BlobHelper ...@@ -279,12 +279,12 @@ module BlobHelper
options = [] options = []
if can?(current_user, :create_issue, project) if can?(current_user, :create_issue, project)
options << link_to("submit an issue", new_namespace_project_issue_path(project.namespace, project)) options << link_to("submit an issue", new_project_issue_path(project))
end end
merge_project = can?(current_user, :create_merge_request, project) ? project : (current_user && current_user.fork_of(project)) merge_project = can?(current_user, :create_merge_request, project) ? project : (current_user && current_user.fork_of(project))
if merge_project if merge_project
options << link_to("create a merge request", namespace_project_new_merge_request_path(project.namespace, project)) options << link_to("create a merge request", project_new_merge_request_path(project))
end end
options options
......
...@@ -5,13 +5,13 @@ module BoardsHelper ...@@ -5,13 +5,13 @@ module BoardsHelper
board = @board || @boards.first board = @board || @boards.first
{ {
endpoint: namespace_project_boards_path(@project.namespace, @project), endpoint: project_boards_path(@project),
board_id: board.id, board_id: board.id,
board_milestone_title: board&.milestone&.title, board_milestone_title: board&.milestone&.title,
disabled: "#{!can?(current_user, :admin_list, @project)}", disabled: "#{!can?(current_user, :admin_list, @project)}",
issue_link_base: namespace_project_issues_path(@project.namespace, @project), issue_link_base: project_issues_path(@project),
root_path: root_path, root_path: root_path,
bulk_update_path: bulk_update_namespace_project_issues_path(@project.namespace, @project), bulk_update_path: bulk_update_project_issues_path(@project),
default_avatar: image_path(default_avatar) default_avatar: image_path(default_avatar)
} }
end end
......
...@@ -7,7 +7,7 @@ module BranchesHelper ...@@ -7,7 +7,7 @@ module BranchesHelper
options = exist_opts.merge(options) options = exist_opts.merge(options)
namespace_project_branches_path(@project.namespace, @project, @id, options) project_branches_path(@project, @id, options)
end end
def can_push_branch?(project, branch_name) def can_push_branch?(project, branch_name)
......
...@@ -20,8 +20,8 @@ module BuildsHelper ...@@ -20,8 +20,8 @@ module BuildsHelper
def javascript_build_options def javascript_build_options
{ {
page_url: namespace_project_job_url(@project.namespace, @project, @build), page_url: project_job_url(@project, @build),
build_url: namespace_project_job_url(@project.namespace, @project, @build, :json), build_url: project_job_url(@project, @build, :json),
build_status: @build.status, build_status: @build.status,
build_stage: @build.stage, build_stage: @build.stage,
log_state: '' log_state: ''
...@@ -31,7 +31,7 @@ module BuildsHelper ...@@ -31,7 +31,7 @@ module BuildsHelper
def build_failed_issue_options def build_failed_issue_options
{ {
title: "Build Failed ##{@build.id}", title: "Build Failed ##{@build.id}",
description: namespace_project_job_url(@project.namespace, @project, @build) description: project_job_url(@project, @build)
} }
end end
end end
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
module CiStatusHelper module CiStatusHelper
def ci_status_path(pipeline) def ci_status_path(pipeline)
project = pipeline.project project = pipeline.project
namespace_project_pipeline_path(project.namespace, project, pipeline) project_pipeline_path(project, pipeline)
end end
def ci_label_for_status(status) def ci_label_for_status(status)
...@@ -99,10 +99,7 @@ module CiStatusHelper ...@@ -99,10 +99,7 @@ module CiStatusHelper
def render_project_pipeline_status(pipeline_status, tooltip_placement: 'auto left') def render_project_pipeline_status(pipeline_status, tooltip_placement: 'auto left')
project = pipeline_status.project project = pipeline_status.project
path = pipelines_namespace_project_commit_path( path = pipelines_project_commit_path(project, pipeline_status.sha)
project.namespace,
project,
pipeline_status.sha)
render_status_with_link( render_status_with_link(
'commit', 'commit',
...@@ -113,10 +110,7 @@ module CiStatusHelper ...@@ -113,10 +110,7 @@ module CiStatusHelper
def render_commit_status(commit, ref: nil, tooltip_placement: 'auto left') def render_commit_status(commit, ref: nil, tooltip_placement: 'auto left')
project = commit.project project = commit.project
path = pipelines_namespace_project_commit_path( path = pipelines_project_commit_path(project, commit)
project.namespace,
project,
commit)
render_status_with_link( render_status_with_link(
'commit', 'commit',
...@@ -127,7 +121,7 @@ module CiStatusHelper ...@@ -127,7 +121,7 @@ module CiStatusHelper
def render_pipeline_status(pipeline, tooltip_placement: 'auto left') def render_pipeline_status(pipeline, tooltip_placement: 'auto left')
project = pipeline.project project = pipeline.project
path = namespace_project_pipeline_path(project.namespace, project, pipeline) path = project_pipeline_path(project, pipeline)
render_status_with_link('pipeline', pipeline.status, path, tooltip_placement: tooltip_placement) render_status_with_link('pipeline', pipeline.status, path, tooltip_placement: tooltip_placement)
end end
......
...@@ -30,7 +30,7 @@ module CommitsHelper ...@@ -30,7 +30,7 @@ module CommitsHelper
crumbs = content_tag(:li) do crumbs = content_tag(:li) do
link_to( link_to(
@project.path, @project.path,
namespace_project_commits_path(@project.namespace, @project, @ref) project_commits_path(@project, @ref)
) )
end end
...@@ -42,8 +42,7 @@ module CommitsHelper ...@@ -42,8 +42,7 @@ module CommitsHelper
# The text is just the individual part, but the link needs all the parts before it # The text is just the individual part, but the link needs all the parts before it
link_to( link_to(
part, part,
namespace_project_commits_path( project_commits_path(
@project.namespace,
@project, @project,
tree_join(@ref, parts[0..i].join('/')) tree_join(@ref, parts[0..i].join('/'))
) )
...@@ -86,20 +85,20 @@ module CommitsHelper ...@@ -86,20 +85,20 @@ module CommitsHelper
if @path.blank? if @path.blank?
return link_to( return link_to(
_("Browse Files"), _("Browse Files"),
namespace_project_tree_path(project.namespace, project, commit), project_tree_path(project, commit),
class: "btn btn-default" class: "btn btn-default"
) )
elsif @repo.blob_at(commit.id, @path) elsif @repo.blob_at(commit.id, @path)
return link_to( return link_to(
_("Browse File"), _("Browse File"),
namespace_project_blob_path(project.namespace, project, project_blob_path(project,
tree_join(commit.id, @path)), tree_join(commit.id, @path)),
class: "btn btn-default" class: "btn btn-default"
) )
elsif @path.present? elsif @path.present?
return link_to( return link_to(
_("Browse Directory"), _("Browse Directory"),
namespace_project_tree_path(project.namespace, project, project_tree_path(project,
tree_join(commit.id, @path)), tree_join(commit.id, @path)),
class: "btn btn-default" class: "btn btn-default"
) )
...@@ -165,7 +164,7 @@ module CommitsHelper ...@@ -165,7 +164,7 @@ module CommitsHelper
notice: "#{edit_in_new_fork_notice} Try to #{action} this commit again.", notice: "#{edit_in_new_fork_notice} Try to #{action} this commit again.",
notice_now: edit_in_new_fork_notice_now notice_now: edit_in_new_fork_notice_now
} }
fork_path = namespace_project_forks_path(@project.namespace, @project, fork_path = project_forks_path(@project,
namespace_key: current_user.namespace.id, namespace_key: current_user.namespace.id,
continue: continue_params) continue: continue_params)
...@@ -175,7 +174,7 @@ module CommitsHelper ...@@ -175,7 +174,7 @@ module CommitsHelper
def view_file_button(commit_sha, diff_new_path, project) def view_file_button(commit_sha, diff_new_path, project)
link_to( link_to(
namespace_project_blob_path(project.namespace, project, project_blob_path(project,
tree_join(commit_sha, diff_new_path)), tree_join(commit_sha, diff_new_path)),
class: 'btn view-file js-view-file' class: 'btn view-file js-view-file'
) do ) do
......
...@@ -9,8 +9,7 @@ module CompareHelper ...@@ -9,8 +9,7 @@ module CompareHelper
end end
def create_mr_path(from = params[:from], to = params[:to], project = @project) def create_mr_path(from = params[:from], to = params[:to], project = @project)
namespace_project_new_merge_request_path( project_new_merge_request_path(
project.namespace,
project, project,
merge_request: { merge_request: {
source_branch: to, source_branch: to,
......
...@@ -103,18 +103,18 @@ module DiffHelper ...@@ -103,18 +103,18 @@ module DiffHelper
end end
def diff_file_blob_raw_path(diff_file) def diff_file_blob_raw_path(diff_file)
namespace_project_raw_path(@project.namespace, @project, tree_join(diff_file.content_sha, diff_file.file_path)) project_raw_path(@project, tree_join(diff_file.content_sha, diff_file.file_path))
end end
def diff_file_old_blob_raw_path(diff_file) def diff_file_old_blob_raw_path(diff_file)
sha = diff_file.old_content_sha sha = diff_file.old_content_sha
return unless sha return unless sha
namespace_project_raw_path(@project.namespace, @project, tree_join(diff_file.old_content_sha, diff_file.old_path)) project_raw_path(@project, tree_join(diff_file.old_content_sha, diff_file.old_path))
end end
def diff_file_html_data(project, diff_file_path, diff_commit_id) def diff_file_html_data(project, diff_file_path, diff_commit_id)
{ {
blob_diff_path: namespace_project_blob_diff_path(project.namespace, project, blob_diff_path: project_blob_diff_path(project,
tree_join(diff_commit_id, diff_file_path)), tree_join(diff_commit_id, diff_file_path)),
view: diff_view view: diff_view
} }
...@@ -142,7 +142,7 @@ module DiffHelper ...@@ -142,7 +142,7 @@ module DiffHelper
diff_file = viewer.diff_file diff_file = viewer.diff_file
options = [] options = []
blob_url = namespace_project_blob_path(@project.namespace, @project, tree_join(diff_file.content_sha, diff_file.file_path)) blob_url = project_blob_path(@project, tree_join(diff_file.content_sha, diff_file.file_path))
options << link_to('view the blob', blob_url) options << link_to('view the blob', blob_url)
options options
...@@ -163,17 +163,17 @@ module DiffHelper ...@@ -163,17 +163,17 @@ module DiffHelper
end end
def commit_diff_whitespace_link(project, commit, options) def commit_diff_whitespace_link(project, commit, options)
url = namespace_project_commit_path(project.namespace, project, commit.id, params_with_whitespace) url = project_commit_path(project, commit.id, params_with_whitespace)
toggle_whitespace_link(url, options) toggle_whitespace_link(url, options)
end end
def diff_merge_request_whitespace_link(project, merge_request, options) def diff_merge_request_whitespace_link(project, merge_request, options)
url = diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, params_with_whitespace) url = diffs_project_merge_request_path(project, merge_request, params_with_whitespace)
toggle_whitespace_link(url, options) toggle_whitespace_link(url, options)
end end
def diff_compare_whitespace_link(project, from, to, options) def diff_compare_whitespace_link(project, from, to, options)
url = namespace_project_compare_path(project.namespace, project, from, to, params_with_whitespace) url = project_compare_path(project, from, to, params_with_whitespace)
toggle_whitespace_link(url, options) toggle_whitespace_link(url, options)
end end
......
...@@ -4,7 +4,7 @@ module EE ...@@ -4,7 +4,7 @@ module EE
include ApplicationSettingsHelper include ApplicationSettingsHelper
def geo_primary_web_url(project) def geo_primary_web_url(project)
File.join(::Gitlab::Geo.primary_node.url, ::Gitlab::Routing.url_helpers.namespace_project_path(project.namespace, project)) File.join(::Gitlab::Geo.primary_node.url, ::Gitlab::Routing.url_helpers.project_path(project))
end end
def geo_primary_ssh_url_to_repo(project) def geo_primary_ssh_url_to_repo(project)
......
...@@ -8,7 +8,7 @@ module EnvironmentHelper ...@@ -8,7 +8,7 @@ module EnvironmentHelper
def environment_link_for_build(project, build) def environment_link_for_build(project, build)
environment = environment_for_build(project, build) environment = environment_for_build(project, build)
if environment if environment
link_to environment.name, namespace_project_environment_path(project.namespace, project, environment) link_to environment.name, project_environment_path(project, environment)
else else
content_tag :span, build.expanded_environment_name content_tag :span, build.expanded_environment_name
end end
......
module EnvironmentsHelper module EnvironmentsHelper
def environments_list_data def environments_list_data
{ {
endpoint: namespace_project_environments_path(@project.namespace, @project, format: :json) endpoint: project_environments_path(@project, format: :json)
} }
end end
end end
...@@ -99,13 +99,12 @@ module EventsHelper ...@@ -99,13 +99,12 @@ module EventsHelper
def event_feed_url(event) def event_feed_url(event)
if event.issue? if event.issue?
namespace_project_issue_url(event.project.namespace, event.project, project_issue_url(event.project,
event.issue) event.issue)
elsif event.merge_request? elsif event.merge_request?
namespace_project_merge_request_url(event.project.namespace, project_merge_request_url(event.project, event.merge_request)
event.project, event.merge_request)
elsif event.commit_note? elsif event.commit_note?
namespace_project_commit_url(event.project.namespace, event.project, project_commit_url(event.project,
event.note_target) event.note_target)
elsif event.note? elsif event.note?
if event.note_target if event.note_target
...@@ -119,15 +118,15 @@ module EventsHelper ...@@ -119,15 +118,15 @@ module EventsHelper
def push_event_feed_url(event) def push_event_feed_url(event)
if event.push_with_commits? && event.md_ref? if event.push_with_commits? && event.md_ref?
if event.commits_count > 1 if event.commits_count > 1
namespace_project_compare_url(event.project.namespace, event.project, project_compare_url(event.project,
from: event.commit_from, to: from: event.commit_from, to:
event.commit_to) event.commit_to)
else else
namespace_project_commit_url(event.project.namespace, event.project, project_commit_url(event.project,
id: event.commit_to) id: event.commit_to)
end end
else else
namespace_project_commits_url(event.project.namespace, event.project, project_commits_url(event.project,
event.ref_name) event.ref_name)
end end
end end
...@@ -146,15 +145,9 @@ module EventsHelper ...@@ -146,15 +145,9 @@ module EventsHelper
def event_note_target_path(event) def event_note_target_path(event)
if event.commit_note? if event.commit_note?
namespace_project_commit_path(event.project.namespace, project_commit_path(event.project, event.note_target, anchor: dom_id(event.target))
event.project,
event.note_target,
anchor: dom_id(event.target))
elsif event.project_snippet_note? elsif event.project_snippet_note?
namespace_project_snippet_path(event.project.namespace, project_snippet_path(event.project, event.note_target, anchor: dom_id(event.target))
event.project,
event.note_target,
anchor: dom_id(event.target))
else else
polymorphic_path([event.project.namespace.becomes(Namespace), polymorphic_path([event.project.namespace.becomes(Namespace),
event.project, event.note_target], event.project, event.note_target],
......
...@@ -4,7 +4,7 @@ module ExternalWikiHelper ...@@ -4,7 +4,7 @@ module ExternalWikiHelper
if external_wiki_service if external_wiki_service
external_wiki_service.properties['external_wiki_url'] external_wiki_service.properties['external_wiki_url']
else else
namespace_project_wiki_path(project.namespace, project, :home) project_wiki_path(project, :home)
end end
end end
end end
This diff is collapsed.
...@@ -26,9 +26,9 @@ module IssuablesHelper ...@@ -26,9 +26,9 @@ module IssuablesHelper
project = issuable.project project = issuable.project
if issuable.is_a?(MergeRequest) if issuable.is_a?(MergeRequest)
namespace_project_merge_request_path(project.namespace, project, issuable.iid, :json) project_merge_request_path(project, issuable.iid, :json)
else else
namespace_project_issue_path(project.namespace, project, issuable.iid, :json) project_issue_path(project, issuable.iid, :json)
end end
end end
...@@ -205,7 +205,7 @@ module IssuablesHelper ...@@ -205,7 +205,7 @@ module IssuablesHelper
def issuable_initial_data(issuable) def issuable_initial_data(issuable)
data = { data = {
endpoint: namespace_project_issue_path(@project.namespace, @project, issuable), endpoint: project_issue_path(@project, issuable),
canUpdate: can?(current_user, :update_issue, issuable), canUpdate: can?(current_user, :update_issue, issuable),
canDestroy: can?(current_user, :destroy_issue, issuable), canDestroy: can?(current_user, :destroy_issue, issuable),
canMove: current_user ? issuable.can_move?(current_user) : false, canMove: current_user ? issuable.can_move?(current_user) : false,
...@@ -303,7 +303,7 @@ module IssuablesHelper ...@@ -303,7 +303,7 @@ module IssuablesHelper
mark_icon: (is_collapsed ? icon('check-square', class: 'todo-undone') : nil), mark_icon: (is_collapsed ? icon('check-square', class: 'todo-undone') : nil),
issuable_id: issuable.id, issuable_id: issuable.id,
issuable_type: issuable.class.name.underscore, issuable_type: issuable.class.name.underscore,
url: namespace_project_todos_path(@project.namespace, @project), url: project_todos_path(@project),
delete_path: (dashboard_todo_path(todo) if todo), delete_path: (dashboard_todo_path(todo) if todo),
placement: (is_collapsed ? 'left' : nil), placement: (is_collapsed ? 'left' : nil),
container: (is_collapsed ? 'body' : nil) container: (is_collapsed ? 'body' : nil)
......
...@@ -150,7 +150,7 @@ module IssuesHelper ...@@ -150,7 +150,7 @@ module IssuesHelper
Gitlab::UrlBuilder.build(single_discussion.first_note) Gitlab::UrlBuilder.build(single_discussion.first_note)
else else
project = merge_request.project project = merge_request.project
namespace_project_merge_request_path(project.namespace, project, merge_request) project_merge_request_path(project, merge_request)
end end
link_to link_text, path link_to link_text, path
......
...@@ -57,14 +57,14 @@ module LabelsHelper ...@@ -57,14 +57,14 @@ module LabelsHelper
def edit_label_path(label) def edit_label_path(label)
case label case label
when GroupLabel then edit_group_label_path(label.group, label) when GroupLabel then edit_group_label_path(label.group, label)
when ProjectLabel then edit_namespace_project_label_path(label.project.namespace, label.project, label) when ProjectLabel then edit_project_label_path(label.project, label)
end end
end end
def destroy_label_path(label) def destroy_label_path(label)
case label case label
when GroupLabel then group_label_path(label.group, label) when GroupLabel then group_label_path(label.group, label)
when ProjectLabel then namespace_project_label_path(label.project.namespace, label.project, label) when ProjectLabel then project_label_path(label.project, label)
end end
end end
...@@ -127,7 +127,7 @@ module LabelsHelper ...@@ -127,7 +127,7 @@ module LabelsHelper
project = @target_project || @project project = @target_project || @project
if project if project
namespace_project_labels_path(project.namespace, project, :json) project_labels_path(project, :json)
else else
dashboard_labels_path(:json) dashboard_labels_path(:json)
end end
...@@ -149,8 +149,8 @@ module LabelsHelper ...@@ -149,8 +149,8 @@ module LabelsHelper
case label_subscription_status(label, project) case label_subscription_status(label, project)
when 'group-level' then toggle_subscription_group_label_path(label.group, label) when 'group-level' then toggle_subscription_group_label_path(label.group, label)
when 'project-level' then toggle_subscription_namespace_project_label_path(project.namespace, project, label) when 'project-level' then toggle_subscription_project_label_path(project, label)
when 'unsubscribed' then toggle_subscription_namespace_project_label_path(project.namespace, project, label) when 'unsubscribed' then toggle_subscription_project_label_path(project, label)
end end
end end
......
module MergeRequestsHelper module MergeRequestsHelper
def new_mr_path_from_push_event(event) def new_mr_path_from_push_event(event)
target_project = event.project.default_merge_request_target target_project = event.project.default_merge_request_target
namespace_project_new_merge_request_path( project_new_merge_request_path(
event.project.namespace,
event.project, event.project,
new_mr_from_push_event(event, target_project) new_mr_from_push_event(event, target_project)
) )
...@@ -48,8 +47,8 @@ module MergeRequestsHelper ...@@ -48,8 +47,8 @@ module MergeRequestsHelper
end end
def mr_change_branches_path(merge_request) def mr_change_branches_path(merge_request)
namespace_project_new_merge_request_path( project_new_merge_request_path(
@project.namespace, @project, @project,
merge_request: { merge_request: {
source_project_id: merge_request.source_project_id, source_project_id: merge_request.source_project_id,
target_project_id: merge_request.target_project_id, target_project_id: merge_request.target_project_id,
...@@ -121,9 +120,7 @@ module MergeRequestsHelper ...@@ -121,9 +120,7 @@ module MergeRequestsHelper
end end
def merge_request_version_path(project, merge_request, merge_request_diff, start_sha = nil) def merge_request_version_path(project, merge_request, merge_request_diff, start_sha = nil)
diffs_namespace_project_merge_request_path( diffs_project_merge_request_path(project, merge_request, diff_id: merge_request_diff.id, start_sha: start_sha)
project.namespace, project, merge_request,
diff_id: merge_request_diff.id, start_sha: start_sha)
end end
def version_index(merge_request_diff) def version_index(merge_request_diff)
......
module MilestonesHelper module MilestonesHelper
def milestones_filter_path(opts = {}) def milestones_filter_path(opts = {})
if @project if @project
namespace_project_milestones_path(@project.namespace, @project, opts) project_milestones_path(@project, opts)
elsif @group elsif @group
group_milestones_path(@group, opts) group_milestones_path(@group, opts)
else else
...@@ -11,7 +11,7 @@ module MilestonesHelper ...@@ -11,7 +11,7 @@ module MilestonesHelper
def milestones_label_path(opts = {}) def milestones_label_path(opts = {})
if @project if @project
namespace_project_issues_path(@project.namespace, @project, opts) project_issues_path(@project, opts)
elsif @group elsif @group
issues_group_path(@group, opts) issues_group_path(@group, opts)
else else
...@@ -73,7 +73,7 @@ module MilestonesHelper ...@@ -73,7 +73,7 @@ module MilestonesHelper
def milestones_filter_dropdown_path def milestones_filter_dropdown_path
project = @target_project || @project project = @target_project || @project
if project if project
namespace_project_milestones_path(project.namespace, project, :json) project_milestones_path(project, :json)
elsif @group elsif @group
group_milestones_path(@group, :json) group_milestones_path(@group, :json)
else else
...@@ -152,7 +152,7 @@ module MilestonesHelper ...@@ -152,7 +152,7 @@ module MilestonesHelper
def milestone_merge_request_tab_path(milestone) def milestone_merge_request_tab_path(milestone)
if @project if @project
merge_requests_namespace_project_milestone_path(@project.namespace, @project, milestone, format: :json) merge_requests_project_milestone_path(@project, milestone, format: :json)
elsif @group elsif @group
merge_requests_group_milestone_path(@group, milestone.safe_title, title: milestone.title, format: :json) merge_requests_group_milestone_path(@group, milestone.safe_title, title: milestone.title, format: :json)
else else
...@@ -162,7 +162,7 @@ module MilestonesHelper ...@@ -162,7 +162,7 @@ module MilestonesHelper
def milestone_participants_tab_path(milestone) def milestone_participants_tab_path(milestone)
if @project if @project
participants_namespace_project_milestone_path(@project.namespace, @project, milestone, format: :json) participants_project_milestone_path(@project, milestone, format: :json)
elsif @group elsif @group
participants_group_milestone_path(@group, milestone.safe_title, title: milestone.title, format: :json) participants_group_milestone_path(@group, milestone.safe_title, title: milestone.title, format: :json)
else else
...@@ -172,7 +172,7 @@ module MilestonesHelper ...@@ -172,7 +172,7 @@ module MilestonesHelper
def milestone_labels_tab_path(milestone) def milestone_labels_tab_path(milestone)
if @project if @project
labels_namespace_project_milestone_path(@project.namespace, @project, milestone, format: :json) labels_project_milestone_path(@project, milestone, format: :json)
elsif @group elsif @group
labels_group_milestone_path(@group, milestone.safe_title, title: milestone.title, format: :json) labels_group_milestone_path(@group, milestone.safe_title, title: milestone.title, format: :json)
else else
......
...@@ -81,11 +81,11 @@ module NotesHelper ...@@ -81,11 +81,11 @@ module NotesHelper
path_params = version_params.merge(anchor: discussion.line_code) path_params = version_params.merge(anchor: discussion.line_code)
diffs_namespace_project_merge_request_path(discussion.project.namespace, discussion.project, discussion.noteable, path_params) diffs_project_merge_request_path(discussion.project, discussion.noteable, path_params)
elsif discussion.for_commit? elsif discussion.for_commit?
anchor = discussion.line_code if discussion.diff_discussion? anchor = discussion.line_code if discussion.diff_discussion?
namespace_project_commit_path(discussion.project.namespace, discussion.project, discussion.noteable, anchor: anchor) project_commit_path(discussion.project, discussion.noteable, anchor: anchor)
end end
end end
...@@ -93,12 +93,7 @@ module NotesHelper ...@@ -93,12 +93,7 @@ module NotesHelper
if @snippet.is_a?(PersonalSnippet) if @snippet.is_a?(PersonalSnippet)
snippet_notes_path(@snippet) snippet_notes_path(@snippet)
else else
namespace_project_noteable_notes_path( project_noteable_notes_path(@project, target_id: @noteable.id, target_type: @noteable.class.name.underscore)
namespace_id: @project.namespace,
project_id: @project,
target_id: @noteable.id,
target_type: @noteable.class.name.underscore
)
end end
end end
...@@ -106,7 +101,7 @@ module NotesHelper ...@@ -106,7 +101,7 @@ module NotesHelper
if note.noteable.is_a?(PersonalSnippet) if note.noteable.is_a?(PersonalSnippet)
snippet_note_path(note.noteable, note) snippet_note_path(note.noteable, note)
else else
namespace_project_note_path(project.namespace, project, note) project_note_path(project, note)
end end
end end
......
...@@ -366,8 +366,7 @@ module ProjectsHelper ...@@ -366,8 +366,7 @@ module ProjectsHelper
def add_special_file_path(project, file_name:, commit_message: nil, branch_name: nil, context: nil) def add_special_file_path(project, file_name:, commit_message: nil, branch_name: nil, context: nil)
commit_message ||= s_("CommitMessage|Add %{file_name}") % { file_name: file_name.downcase } commit_message ||= s_("CommitMessage|Add %{file_name}") % { file_name: file_name.downcase }
namespace_project_new_blob_path( project_new_blob_path(
project.namespace,
project, project,
project.default_branch || 'master', project.default_branch || 'master',
file_name: file_name, file_name: file_name,
...@@ -378,8 +377,7 @@ module ProjectsHelper ...@@ -378,8 +377,7 @@ module ProjectsHelper
end end
def add_koding_stack_path(project) def add_koding_stack_path(project)
namespace_project_new_blob_path( project_new_blob_path(
project.namespace,
project, project,
project.default_branch || 'master', project.default_branch || 'master',
file_name: '.koding.yml', file_name: '.koding.yml',
...@@ -433,8 +431,7 @@ module ProjectsHelper ...@@ -433,8 +431,7 @@ module ProjectsHelper
def contribution_guide_path(project) def contribution_guide_path(project)
if project && contribution_guide = project.repository.contribution_guide if project && contribution_guide = project.repository.contribution_guide
namespace_project_blob_path( project_blob_path(
project.namespace,
project, project,
tree_join(project.default_branch, tree_join(project.default_branch,
contribution_guide.name) contribution_guide.name)
...@@ -464,7 +461,7 @@ module ProjectsHelper ...@@ -464,7 +461,7 @@ module ProjectsHelper
def project_wiki_path_with_version(proj, page, version, is_newest) def project_wiki_path_with_version(proj, page, version, is_newest)
url_params = is_newest ? {} : { version_id: version } url_params = is_newest ? {} : { version_id: version }
namespace_project_wiki_path(proj.namespace, proj, page, url_params) project_wiki_path(proj, page, url_params)
end end
def project_status_css_class(status) def project_status_css_class(status)
...@@ -503,8 +500,7 @@ module ProjectsHelper ...@@ -503,8 +500,7 @@ module ProjectsHelper
def filename_path(project, filename) def filename_path(project, filename)
if project && blob = project.repository.send(filename) if project && blob = project.repository.send(filename)
namespace_project_blob_path( project_blob_path(
project.namespace,
project, project,
tree_join(project.default_branch, blob.name) tree_join(project.default_branch, blob.name)
) )
......
...@@ -41,7 +41,7 @@ module SearchHelper ...@@ -41,7 +41,7 @@ module SearchHelper
def find_project_for_blob(blob) def find_project_for_blob(blob)
Project.find(blob['_parent']) Project.find(blob['_parent'])
end end
private private
# Autocomplete results for various settings pages # Autocomplete results for various settings pages
...@@ -75,16 +75,16 @@ module SearchHelper ...@@ -75,16 +75,16 @@ module SearchHelper
ref = @ref || @project.repository.root_ref ref = @ref || @project.repository.root_ref
[ [
{ category: "Current Project", label: "Files", url: namespace_project_tree_path(@project.namespace, @project, ref) }, { category: "Current Project", label: "Files", url: project_tree_path(@project, ref) },
{ category: "Current Project", label: "Commits", url: namespace_project_commits_path(@project.namespace, @project, ref) }, { category: "Current Project", label: "Commits", url: project_commits_path(@project, ref) },
{ category: "Current Project", label: "Network", url: namespace_project_network_path(@project.namespace, @project, ref) }, { category: "Current Project", label: "Network", url: project_network_path(@project, ref) },
{ category: "Current Project", label: "Graph", url: namespace_project_graph_path(@project.namespace, @project, ref) }, { category: "Current Project", label: "Graph", url: project_graph_path(@project, ref) },
{ category: "Current Project", label: "Issues", url: namespace_project_issues_path(@project.namespace, @project) }, { category: "Current Project", label: "Issues", url: project_issues_path(@project) },
{ category: "Current Project", label: "Merge Requests", url: namespace_project_merge_requests_path(@project.namespace, @project) }, { category: "Current Project", label: "Merge Requests", url: project_merge_requests_path(@project) },
{ category: "Current Project", label: "Milestones", url: namespace_project_milestones_path(@project.namespace, @project) }, { category: "Current Project", label: "Milestones", url: project_milestones_path(@project) },
{ category: "Current Project", label: "Snippets", url: namespace_project_snippets_path(@project.namespace, @project) }, { category: "Current Project", label: "Snippets", url: project_snippets_path(@project) },
{ category: "Current Project", label: "Members", url: namespace_project_settings_members_path(@project.namespace, @project) }, { category: "Current Project", label: "Members", url: project_settings_members_path(@project) },
{ category: "Current Project", label: "Wiki", url: namespace_project_wikis_path(@project.namespace, @project) } { category: "Current Project", label: "Wiki", url: project_wikis_path(@project) }
] ]
else else
[] []
...@@ -112,7 +112,7 @@ module SearchHelper ...@@ -112,7 +112,7 @@ module SearchHelper
id: p.id, id: p.id,
value: "#{search_result_sanitize(p.name)}", value: "#{search_result_sanitize(p.name)}",
label: "#{search_result_sanitize(p.name_with_namespace)}", label: "#{search_result_sanitize(p.name_with_namespace)}",
url: namespace_project_path(p.namespace, p) url: project_path(p)
} }
end end
end end
......
module SnippetsHelper module SnippetsHelper
def reliable_snippet_path(snippet, opts = nil) def reliable_snippet_path(snippet, opts = nil)
if snippet.project_id? if snippet.project_id?
namespace_project_snippet_path(snippet.project.namespace, project_snippet_path(snippet.project, snippet, opts)
snippet.project, snippet, opts)
else else
snippet_path(snippet, opts) snippet_path(snippet, opts)
end end
...@@ -10,7 +9,7 @@ module SnippetsHelper ...@@ -10,7 +9,7 @@ module SnippetsHelper
def download_snippet_path(snippet) def download_snippet_path(snippet)
if snippet.project_id if snippet.project_id
raw_namespace_project_snippet_path(@project.namespace, @project, snippet, inline: false) raw_project_snippet_path(@project, snippet, inline: false)
else else
raw_snippet_path(snippet, inline: false) raw_snippet_path(snippet, inline: false)
end end
...@@ -21,7 +20,7 @@ module SnippetsHelper ...@@ -21,7 +20,7 @@ module SnippetsHelper
# @returns String, path to snippet index # @returns String, path to snippet index
def subject_snippets_path(subject = nil, opts = nil) def subject_snippets_path(subject = nil, opts = nil)
if subject.is_a?(Project) if subject.is_a?(Project)
namespace_project_snippets_path(subject.namespace, subject, opts) project_snippets_path(subject, opts)
else # assume subject === User else # assume subject === User
dashboard_snippets_path(opts) dashboard_snippets_path(opts)
end end
......
...@@ -107,8 +107,7 @@ module TabHelper ...@@ -107,8 +107,7 @@ module TabHelper
def branches_tab_class def branches_tab_class
if current_controller?(:protected_branches) || if current_controller?(:protected_branches) ||
current_controller?(:branches) || current_controller?(:branches) ||
current_page?(namespace_project_repository_path(@project.namespace, current_page?(project_repository_path(@project))
@project))
'active' 'active'
end end
end end
......
...@@ -10,7 +10,7 @@ module TagsHelper ...@@ -10,7 +10,7 @@ module TagsHelper
} }
options = exist_opts.merge(options) options = exist_opts.merge(options)
namespace_project_tags_path(@project.namespace, @project, @id, options) project_tags_path(@project, @id, options)
end end
def tag_list(project) def tag_list(project)
......
...@@ -39,7 +39,7 @@ module TodosHelper ...@@ -39,7 +39,7 @@ module TodosHelper
anchor = dom_id(todo.note) if todo.note.present? anchor = dom_id(todo.note) if todo.note.present?
if todo.for_commit? if todo.for_commit?
namespace_project_commit_path(todo.project.namespace.becomes(Namespace), todo.project, project_commit_path(todo.project,
todo.target, anchor: anchor) todo.target, anchor: anchor)
else else
path = [todo.project.namespace.becomes(Namespace), todo.project, todo.target] path = [todo.project.namespace.becomes(Namespace), todo.project, todo.target]
......
...@@ -31,7 +31,7 @@ module Emails ...@@ -31,7 +31,7 @@ module Emails
setup_issue_mail(issue_id, recipient_id) setup_issue_mail(issue_id, recipient_id)
@label_names = label_names @label_names = label_names
@labels_url = namespace_project_labels_url(@project.namespace, @project) @labels_url = project_labels_url(@project)
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id)) mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id))
end end
...@@ -56,7 +56,7 @@ module Emails ...@@ -56,7 +56,7 @@ module Emails
def setup_issue_mail(issue_id, recipient_id) def setup_issue_mail(issue_id, recipient_id)
@issue = Issue.find(issue_id) @issue = Issue.find(issue_id)
@project = @issue.project @project = @issue.project
@target_url = namespace_project_issue_url(@project.namespace, @project, @issue) @target_url = project_issue_url(@project, @issue)
@sent_notification = SentNotification.record(@issue, recipient_id, reply_key) @sent_notification = SentNotification.record(@issue, recipient_id, reply_key)
end end
......
...@@ -22,7 +22,7 @@ module Emails ...@@ -22,7 +22,7 @@ module Emails
setup_merge_request_mail(merge_request_id, recipient_id) setup_merge_request_mail(merge_request_id, recipient_id)
@label_names = label_names @label_names = label_names
@labels_url = namespace_project_labels_url(@project.namespace, @project) @labels_url = project_labels_url(@project)
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id)) mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id))
end end
...@@ -80,7 +80,7 @@ module Emails ...@@ -80,7 +80,7 @@ module Emails
def setup_merge_request_mail(merge_request_id, recipient_id) def setup_merge_request_mail(merge_request_id, recipient_id)
@merge_request = MergeRequest.find(merge_request_id) @merge_request = MergeRequest.find(merge_request_id)
@project = @merge_request.project @project = @merge_request.project
@target_url = namespace_project_merge_request_url(@project.namespace, @project, @merge_request) @target_url = project_merge_request_url(@project, @merge_request)
@sent_notification = SentNotification.record(@merge_request, recipient_id, reply_key) @sent_notification = SentNotification.record(@merge_request, recipient_id, reply_key)
end end
......
...@@ -4,7 +4,7 @@ module Emails ...@@ -4,7 +4,7 @@ module Emails
setup_note_mail(note_id, recipient_id) setup_note_mail(note_id, recipient_id)
@commit = @note.noteable @commit = @note.noteable
@target_url = namespace_project_commit_url(*note_target_url_options) @target_url = project_commit_url(*note_target_url_options)
mail_answer_thread(@commit, note_thread_options(recipient_id)) mail_answer_thread(@commit, note_thread_options(recipient_id))
end end
...@@ -12,7 +12,7 @@ module Emails ...@@ -12,7 +12,7 @@ module Emails
setup_note_mail(note_id, recipient_id) setup_note_mail(note_id, recipient_id)
@issue = @note.noteable @issue = @note.noteable
@target_url = namespace_project_issue_url(*note_target_url_options) @target_url = project_issue_url(*note_target_url_options)
mail_answer_thread(@issue, note_thread_options(recipient_id)) mail_answer_thread(@issue, note_thread_options(recipient_id))
end end
...@@ -20,7 +20,7 @@ module Emails ...@@ -20,7 +20,7 @@ module Emails
setup_note_mail(note_id, recipient_id) setup_note_mail(note_id, recipient_id)
@merge_request = @note.noteable @merge_request = @note.noteable
@target_url = namespace_project_merge_request_url(*note_target_url_options) @target_url = project_merge_request_url(*note_target_url_options)
mail_answer_thread(@merge_request, note_thread_options(recipient_id)) mail_answer_thread(@merge_request, note_thread_options(recipient_id))
end end
...@@ -28,7 +28,7 @@ module Emails ...@@ -28,7 +28,7 @@ module Emails
setup_note_mail(note_id, recipient_id) setup_note_mail(note_id, recipient_id)
@snippet = @note.noteable @snippet = @note.noteable
@target_url = namespace_project_snippet_url(*note_target_url_options) @target_url = project_snippet_url(*note_target_url_options)
mail_answer_thread(@snippet, note_thread_options(recipient_id)) mail_answer_thread(@snippet, note_thread_options(recipient_id))
end end
...@@ -43,7 +43,7 @@ module Emails ...@@ -43,7 +43,7 @@ module Emails
private private
def note_target_url_options def note_target_url_options
[@project.namespace, @project, @note.noteable, anchor: "note_#{@note.id}"] [@project, @note.noteable, anchor: "note_#{@note.id}"]
end end
def note_thread_options(recipient_id) def note_thread_options(recipient_id)
......
...@@ -3,7 +3,7 @@ module Emails ...@@ -3,7 +3,7 @@ module Emails
def project_was_moved_email(project_id, user_id, old_path_with_namespace) def project_was_moved_email(project_id, user_id, old_path_with_namespace)
@current_user = @user = User.find user_id @current_user = @user = User.find user_id
@project = Project.find project_id @project = Project.find project_id
@target_url = namespace_project_url(@project.namespace, @project) @target_url = project_url(@project)
@old_path_with_namespace = old_path_with_namespace @old_path_with_namespace = old_path_with_namespace
mail(to: @user.notification_email, mail(to: @user.notification_email,
subject: subject("Project was moved")) subject: subject("Project was moved"))
......
class Notify < BaseMailer class Notify < BaseMailer
include ActionDispatch::Routing::PolymorphicRoutes include ActionDispatch::Routing::PolymorphicRoutes
include GitlabRoutingHelper
include Emails::AdminNotification include Emails::AdminNotification
include Emails::Issues include Emails::Issues
......
...@@ -281,7 +281,7 @@ module EE ...@@ -281,7 +281,7 @@ module EE
# No need to have a Kerberos Web url. Kerberos URL will be used only to # No need to have a Kerberos Web url. Kerberos URL will be used only to
# clone # clone
def kerberos_url_to_repo def kerberos_url_to_repo
"#{::Gitlab.config.build_gitlab_kerberos_url + ::Gitlab::Application.routes.url_helpers.namespace_project_path(self.namespace, self)}.git" "#{::Gitlab.config.build_gitlab_kerberos_url + ::Gitlab::Routing.url_helpers.project_path(self)}.git"
end end
def group_ldap_synced? def group_ldap_synced?
......
...@@ -222,8 +222,7 @@ class Environment < ActiveRecord::Base ...@@ -222,8 +222,7 @@ class Environment < ActiveRecord::Base
end end
def etag_cache_key def etag_cache_key
Gitlab::Routing.url_helpers.namespace_project_environments_path( Gitlab::Routing.url_helpers.project_environments_path(
project.namespace,
project, project,
format: :json) format: :json)
end end
......
...@@ -328,11 +328,7 @@ class Issue < ActiveRecord::Base ...@@ -328,11 +328,7 @@ class Issue < ActiveRecord::Base
end end
def expire_etag_cache def expire_etag_cache
key = Gitlab::Routing.url_helpers.realtime_changes_namespace_project_issue_path( key = Gitlab::Routing.url_helpers.realtime_changes_project_issue_path(project, self)
project.namespace,
project,
self
)
Gitlab::EtagCaching::Store.new.touch(key) Gitlab::EtagCaching::Store.new.touch(key)
end end
end end
...@@ -336,8 +336,7 @@ class Note < ActiveRecord::Base ...@@ -336,8 +336,7 @@ class Note < ActiveRecord::Base
def expire_etag_cache def expire_etag_cache
return unless for_issue? return unless for_issue?
key = Gitlab::Routing.url_helpers.namespace_project_noteable_notes_path( key = Gitlab::Routing.url_helpers.project_noteable_notes_path(
noteable.project.namespace,
noteable.project, noteable.project,
target_type: noteable_type.underscore, target_type: noteable_type.underscore,
target_id: noteable.id target_id: noteable.id
......
...@@ -676,7 +676,7 @@ class Project < ActiveRecord::Base ...@@ -676,7 +676,7 @@ class Project < ActiveRecord::Base
end end
def web_url def web_url
Gitlab::Routing.url_helpers.namespace_project_url(self.namespace, self) Gitlab::Routing.url_helpers.project_url(self)
end end
def new_issue_address(author) def new_issue_address(author)
...@@ -852,7 +852,7 @@ class Project < ActiveRecord::Base ...@@ -852,7 +852,7 @@ class Project < ActiveRecord::Base
def avatar_url(**args) def avatar_url(**args)
# We use avatar_path instead of overriding avatar_url because of carrierwave. # We use avatar_path instead of overriding avatar_url because of carrierwave.
# See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11001/diffs#note_28659864 # See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11001/diffs#note_28659864
avatar_path(args) || (Gitlab::Routing.url_helpers.namespace_project_avatar_url(namespace, self) if avatar_in_git) avatar_path(args) || (Gitlab::Routing.url_helpers.project_avatar_url(self) if avatar_in_git)
end end
# For compatibility with old code # For compatibility with old code
......
...@@ -12,26 +12,26 @@ class GitlabIssueTrackerService < IssueTrackerService ...@@ -12,26 +12,26 @@ class GitlabIssueTrackerService < IssueTrackerService
end end
def project_url def project_url
namespace_project_issues_url(project.namespace, project) project_issues_url(project)
end end
def new_issue_url def new_issue_url
new_namespace_project_issue_url(namespace_id: project.namespace, project_id: project) new_project_issue_url(project)
end end
def issue_url(iid) def issue_url(iid)
namespace_project_issue_url(namespace_id: project.namespace, project_id: project, id: iid) project_issue_url(project, id: iid)
end end
def project_path def project_path
namespace_project_issues_path(project.namespace, project) project_issues_path(project)
end end
def new_issue_path def new_issue_path
new_namespace_project_issue_path(namespace_id: project.namespace, project_id: project) new_project_issue_path(project)
end end
def issue_path(iid) def issue_path(iid)
namespace_project_issue_path(namespace_id: project.namespace, project_id: project, id: iid) project_issue_path(project, id: iid)
end end
end end
...@@ -25,7 +25,7 @@ class IssueTrackerService < Service ...@@ -25,7 +25,7 @@ class IssueTrackerService < Service
end end
def project_path def project_path
project_url read_attribute(:project_url)
end end
def new_issue_path def new_issue_path
......
...@@ -152,8 +152,8 @@ class JiraService < IssueTrackerService ...@@ -152,8 +152,8 @@ class JiraService < IssueTrackerService
url: resource_url(user_path(author)) url: resource_url(user_path(author))
}, },
project: { project: {
name: self.project.path_with_namespace, name: project.path_with_namespace,
url: resource_url(namespace_project_path(project.namespace, self.project)) url: resource_url(namespace_project_path(project.namespace, project)) # rubocop:disable Cop/ProjectPathHelper
}, },
entity: { entity: {
name: noteable_type.humanize.downcase, name: noteable_type.humanize.downcase,
......
...@@ -33,7 +33,7 @@ class ProjectWiki ...@@ -33,7 +33,7 @@ class ProjectWiki
end end
def web_url def web_url
Gitlab::Routing.url_helpers.namespace_project_wiki_url(@project.namespace, @project, :home) Gitlab::Routing.url_helpers.project_wiki_url(@project, :home)
end end
def url_to_repo def url_to_repo
......
...@@ -20,30 +20,25 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated ...@@ -20,30 +20,25 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
def cancel_merge_when_pipeline_succeeds_path def cancel_merge_when_pipeline_succeeds_path
if can_cancel_merge_when_pipeline_succeeds?(current_user) if can_cancel_merge_when_pipeline_succeeds?(current_user)
cancel_merge_when_pipeline_succeeds_namespace_project_merge_request_path( cancel_merge_when_pipeline_succeeds_project_merge_request_path(project, merge_request)
project.namespace,
project,
merge_request)
end end
end end
def create_issue_to_resolve_discussions_path def create_issue_to_resolve_discussions_path
if can?(current_user, :create_issue, project) && project.issues_enabled? if can?(current_user, :create_issue, project) && project.issues_enabled?
new_namespace_project_issue_path(project.namespace, new_project_issue_path(project, merge_request_to_resolve_discussions_of: iid)
project,
merge_request_to_resolve_discussions_of: iid)
end end
end end
def remove_wip_path def remove_wip_path
if can?(current_user, :update_merge_request, merge_request.project) if can?(current_user, :update_merge_request, merge_request.project)
remove_wip_namespace_project_merge_request_path(project.namespace, project, merge_request) remove_wip_project_merge_request_path(project, merge_request)
end end
end end
def merge_path def merge_path
if can_be_merged_by?(current_user) if can_be_merged_by?(current_user)
merge_namespace_project_merge_request_path(project.namespace, project, merge_request) merge_project_merge_request_path(project, merge_request)
end end
end end
...@@ -55,7 +50,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated ...@@ -55,7 +50,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
notice_now: edit_in_new_fork_notice_now notice_now: edit_in_new_fork_notice_now
} }
namespace_project_forks_path(merge_request.project.namespace, merge_request.project, project_forks_path(merge_request.project,
namespace_key: current_user.namespace.id, namespace_key: current_user.namespace.id,
continue: continue_params) continue: continue_params)
end end
...@@ -69,7 +64,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated ...@@ -69,7 +64,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
notice_now: edit_in_new_fork_notice_now notice_now: edit_in_new_fork_notice_now
} }
namespace_project_forks_path(project.namespace, project, project_forks_path(project,
namespace_key: current_user.namespace.id, namespace_key: current_user.namespace.id,
continue: continue_params) continue: continue_params)
end end
...@@ -77,35 +72,31 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated ...@@ -77,35 +72,31 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
def conflict_resolution_path def conflict_resolution_path
if conflicts.can_be_resolved_in_ui? && conflicts.can_be_resolved_by?(current_user) if conflicts.can_be_resolved_in_ui? && conflicts.can_be_resolved_by?(current_user)
conflicts_namespace_project_merge_request_path(project.namespace, project, merge_request) conflicts_project_merge_request_path(project, merge_request)
end end
end end
def rebase_path def rebase_path
if !rebase_in_progress? && should_be_rebased? && user_can_push_to_source_branch? if !rebase_in_progress? && should_be_rebased? && user_can_push_to_source_branch?
rebase_namespace_project_merge_request_path(project.namespace, rebase_project_merge_request_path(project, merge_request)
project,
merge_request)
end end
end end
def target_branch_commits_path def target_branch_commits_path
if target_branch_exists? if target_branch_exists?
namespace_project_commits_path(project.namespace, project, target_branch) project_commits_path(project, target_branch)
end end
end end
def source_branch_path def source_branch_path
if source_branch_exists? if source_branch_exists?
namespace_project_branch_path(source_project.namespace, source_project, source_branch) project_branch_path(source_project, source_branch)
end end
end end
def approvals_path def approvals_path
if requires_approve? if requires_approve?
approvals_namespace_project_merge_request_path(project.namespace, approvals_project_merge_request_path(project, merge_request)
project,
merge_request)
end end
end end
...@@ -115,7 +106,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated ...@@ -115,7 +106,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
if source_branch_exists? if source_branch_exists?
namespace = link_to(namespace, project_path(source_project)) namespace = link_to(namespace, project_path(source_project))
branch = link_to(branch, namespace_project_commits_path(source_project.namespace, source_project, source_branch)) branch = link_to(branch, project_commits_path(source_project, source_branch))
end end
if for_fork? if for_fork?
...@@ -152,7 +143,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated ...@@ -152,7 +143,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
merge_request: merge_request, merge_request: merge_request,
closes_issues: closing_issues closes_issues: closing_issues
).assignable_issues ).assignable_issues
path = assign_related_issues_namespace_project_merge_request_path(project.namespace, project, merge_request) path = assign_related_issues_project_merge_request_path(project, merge_request)
if issues.present? if issues.present?
pluralize_this_issue = issues.count > 1 ? "these issues" : "this issue" pluralize_this_issue = issues.count > 1 ? "these issues" : "this issue"
link_to "Assign yourself to #{pluralize_this_issue}", path, method: :post link_to "Assign yourself to #{pluralize_this_issue}", path, method: :post
......
...@@ -6,10 +6,7 @@ class BuildActionEntity < Grape::Entity ...@@ -6,10 +6,7 @@ class BuildActionEntity < Grape::Entity
end end
expose :path do |build| expose :path do |build|
play_namespace_project_job_path( play_project_job_path(build.project, build)
build.project.namespace,
build.project,
build)
end end
expose :playable?, as: :playable expose :playable?, as: :playable
......
...@@ -9,24 +9,15 @@ class BuildArtifactEntity < Grape::Entity ...@@ -9,24 +9,15 @@ class BuildArtifactEntity < Grape::Entity
expose :artifacts_expire_at, as: :expire_at expose :artifacts_expire_at, as: :expire_at
expose :path do |job| expose :path do |job|
download_namespace_project_job_artifacts_path( download_project_job_artifacts_path(project, job)
project.namespace,
project,
job)
end end
expose :keep_path, if: -> (*) { job.has_expiring_artifacts? } do |job| expose :keep_path, if: -> (*) { job.has_expiring_artifacts? } do |job|
keep_namespace_project_job_artifacts_path( keep_project_job_artifacts_path(project, job)
project.namespace,
project,
job)
end end
expose :browse_path do |job| expose :browse_path do |job|
browse_namespace_project_job_artifacts_path( browse_project_job_artifacts_path(project, job)
project.namespace,
project,
job)
end end
private private
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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