Merge branch 'patch-git-private-email-instruction' into 'master'
fix: show preferred commit email in empty project page See merge request gitlab-org/gitlab-ce!32182
This commit is contained in:
commit
e31e4aeb8c
2 changed files with 37 additions and 1 deletions
|
@ -448,7 +448,7 @@ module ProjectsHelper
|
||||||
|
|
||||||
def git_user_email
|
def git_user_email
|
||||||
if current_user
|
if current_user
|
||||||
current_user.email
|
current_user.commit_email
|
||||||
else
|
else
|
||||||
"your@email.com"
|
"your@email.com"
|
||||||
end
|
end
|
||||||
|
|
|
@ -549,6 +549,42 @@ describe ProjectsHelper do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#git_user_email' do
|
||||||
|
context 'not logged-in' do
|
||||||
|
before do
|
||||||
|
allow(helper).to receive(:current_user).and_return(nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns your@email.com' do
|
||||||
|
expect(helper.send(:git_user_email)).to eq('your@email.com')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'user logged in' do
|
||||||
|
let(:user) { create(:user) }
|
||||||
|
before do
|
||||||
|
allow(helper).to receive(:current_user).and_return(user)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'user has no configured commit email' do
|
||||||
|
it 'returns the primary email' do
|
||||||
|
expect(helper.send(:git_user_email)).to eq(user.email)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'user has a configured commit email' do
|
||||||
|
before do
|
||||||
|
confirmed_email = create(:email, :confirmed, user: user)
|
||||||
|
user.update(commit_email: confirmed_email)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns the commit email' do
|
||||||
|
expect(helper.send(:git_user_email)).to eq(user.commit_email)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'show_xcode_link' do
|
describe 'show_xcode_link' do
|
||||||
let!(:project) { create(:project) }
|
let!(:project) { create(:project) }
|
||||||
let(:mac_ua) { 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36' }
|
let(:mac_ua) { 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36' }
|
||||||
|
|
Loading…
Reference in a new issue