Commit aebf867a authored by Brandon Labuschagne's avatar Brandon Labuschagne

Add verification badge to users emails

This is being applied to the admin users view, when an admin
selects a user profile tp view.

It gives admins the ability to see an email verification status
without the need of impersonating a user.
parent e5ca7b8b
......@@ -32,11 +32,12 @@
%li
%span.light Email:
%strong
= mail_to @user.email
= render partial: 'shared/email_with_badge', locals: { email: mail_to(@user.email), verified: @user.confirmed? }
- @user.emails.each do |email|
%li
%span.light Secondary email:
%strong= email.email
%strong
= render partial: 'shared/email_with_badge', locals: { email: email.email, verified: email.confirmed? }
= link_to remove_email_admin_user_path(@user, email), data: { confirm: "Are you sure you want to remove #{email.email}?" }, method: :delete, class: "btn-sm btn btn-remove float-right", title: 'Remove secondary email', id: "remove_email_#{email.id}" do
%i.fa.fa-times
%li
......
---
title: Add a verified pill next to email addresses under the admin users section.
merge_request: 29669
author:
type: added
......@@ -419,6 +419,32 @@ describe "Admin::Users" do
end
end
end
describe 'Email verification status' do
let!(:secondary_email) do
create :email, email: 'secondary@example.com', user: user
end
it 'displays the correct status for an unverified email address' do
user.update(confirmed_at: nil, unconfirmed_email: user.email)
visit admin_user_path(user)
expect(page).to have_content("#{user.email} Unverified")
expect(page).to have_content("#{secondary_email.email} Unverified")
end
it 'displays the correct status for a verified email address' do
visit admin_user_path(user)
expect(page).to have_content("#{user.email} Verified")
secondary_email.confirm
expect(secondary_email.confirmed?).to be_truthy
visit admin_user_path(user)
expect(page).to have_content("#{secondary_email.email} Verified")
end
end
end
describe "GET /admin/users/:id/edit" do
......
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