Commit 062c9a08 authored by tiagonbotelho's avatar tiagonbotelho

change empty project view to annonymous user from activity to empty partial

parent 0527ea09
......@@ -50,9 +50,7 @@ module PreferencesHelper
end
def default_project_view
unless current_user
return @repository.head_commit ? 'readme' : 'activity'
end
return annonymous_project_view unless current_user
user_view = current_user.project_view
......@@ -68,4 +66,8 @@ module PreferencesHelper
"customize_workflow"
end
end
def annonymous_project_view
@project.empty_repo? ? 'empty' : 'readme'
end
end
......@@ -554,8 +554,6 @@ class Repository
end
def readme
return unless head_commit
cache.fetch(:readme) { tree(:head).readme }
end
......
.row-content-block.second-block.center
%h3.page-title
The repository for this project is empty
......@@ -90,19 +90,16 @@ describe PreferencesHelper do
let(:project) { create(:project) }
context 'user not signed in' do
before do
stub_user
@repository = project.repository
end
before { stub_user }
it 'returns readme view if repository is not empty' do
expect(helper.default_project_view).to eq('readme')
end
it 'returns activity if repository is empty' do
expect(@repository).to receive(:head_commit).and_return(nil)
expect(project).to receive(:empty_repo?).and_return(true)
expect(helper.default_project_view).to eq('activity')
expect(helper.default_project_view).to eq('empty')
end
end
end
......
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