Scope environments to project

This commit is contained in:
Kamil Trzcinski 2016-09-21 13:13:50 +02:00
parent 29a64950dd
commit 9410599391
4 changed files with 8 additions and 2 deletions

View file

@ -70,6 +70,10 @@ module GitlabRoutingHelper
namespace_project_runner_path(@project.namespace, @project, runner, *args)
end
def environment_path(environment, *args)
namespace_project_environment_path(environment.project.namespace, environment.project, environment, *args)
end
def issue_path(entity, *args)
namespace_project_issue_path(entity.project.namespace, entity.project, entity, *args)
end

View file

@ -1304,7 +1304,7 @@ class Project < ActiveRecord::Base
environment_ids.where(ref: ref)
end
Environment.where(id: environment_ids).select do |environment|
environments.where(id: environment_ids).select do |environment|
environment.includes_commit?(commit)
end
end

View file

@ -51,7 +51,7 @@
%span.hidden-sm
Deployed to
= succeed '.' do
= link_to environment.name, namespace_project_environment_path(environment.project.namespace, environment.project, environment), class: 'environment'
= link_to environment.name, environment_path(environment), class: 'environment'
- external_url = environment.external_url
- if external_url
= link_to external_url, target: '_blank' do

View file

@ -15,6 +15,8 @@ describe 'projects/merge_requests/widget/_heading' do
assign(:merge_request, merge_request)
assign(:project, project)
allow(view).to receive(:can?).and_return(true)
render
end