Commit b1731adf authored by James Lopez's avatar James Lopez

workaround for forks with an invalid repo - avoid showing them in the list

parent 3de6edd6
...@@ -5,7 +5,9 @@ class Projects::ForksController < Projects::ApplicationController ...@@ -5,7 +5,9 @@ class Projects::ForksController < Projects::ApplicationController
def index def index
@sort = params[:sort] || 'id_desc' @sort = params[:sort] || 'id_desc'
@all_forks = project.forks.includes(:creator).order_by(@sort) @all_forks = project.forks.includes(:creator).order_by(@sort).reject do |project|
project.repository.raw_repository.nil?
end
@public_forks, @protected_forks = @all_forks.partition do |project| @public_forks, @protected_forks = @all_forks.partition do |project|
can?(current_user, :read_project, project) can?(current_user, :read_project, project)
......
...@@ -32,6 +32,13 @@ Feature: Project Fork ...@@ -32,6 +32,13 @@ Feature: Project Fork
And I visit the forks page of the "Shop" project And I visit the forks page of the "Shop" project
Then I should see my fork on the list Then I should see my fork on the list
Scenario: Viewing forks of a Project that has no repo
Given I click link "Fork"
When I fork to my namespace
And I make forked repo invalid
And I visit the forks page of the "Shop" project
Then I should not see the invalid fork listed
Scenario: Viewing private forks of a Project Scenario: Viewing private forks of a Project
Given There is an existent fork of the "Shop" project Given There is an existent fork of the "Shop" project
And I click link "Fork" And I click link "Fork"
......
...@@ -62,6 +62,17 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps ...@@ -62,6 +62,17 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps
end end
end end
step 'I make forked repo invalid' do
project = @user.fork_of(@project)
project.path = 'test-crappy-path'
project.save!
end
step 'I should not see the invalid fork listed' do
project = @user.fork_of(@project)
expect(page).not_to have_content("#{project.namespace.human_name} / #{project.name}")
end
step 'There is an existent fork of the "Shop" project' do step 'There is an existent fork of the "Shop" project' do
user = create(:user, name: 'Mike') user = create(:user, name: 'Mike')
@forked_project = Projects::ForkService.new(@project, user).execute @forked_project = Projects::ForkService.new(@project, user).execute
......
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