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