Commit 19787fb4 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch 'do-not-show-duplicated-user-primary-email-in-admin-view' into 'master'

Do not show primary email as secondary email in Admin view

See merge request gitlab-org/gitlab!75095
parents 5958469f c00c8fd2
......@@ -35,7 +35,7 @@
%span.light= _('Email:')
%strong
= render partial: 'shared/email_with_badge', locals: { email: mail_to(@user.email), verified: @user.confirmed? }
- @user.emails.each do |email|
- @user.emails.reject(&:user_primary_email?).each do |email|
%li
%span.light= _('Secondary email:')
%strong
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'admin/users/show.html.haml' do
let_it_be(:user) { create(:user) }
let_it_be(:user) { create(:user, email: 'user@example.com') }
let(:page) { Nokogiri::HTML.parse(rendered) }
let(:status) { page.at('#credit-card-status')&.text }
......@@ -19,6 +19,12 @@ RSpec.describe 'admin/users/show.html.haml' do
expect(status).to be_nil
end
it 'does not show primary email as secondary email - lists primary email only once' do
render
expect(rendered).to have_text('user@example.com', count: 1)
end
context 'Gitlab.com' do
before do
allow(::Gitlab).to receive(:com?).and_return(true)
......
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