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.
This commit is contained in:
parent
e5ca7b8b0b
commit
aebf867aee
|
@ -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
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue