Don't ask verified users to verify their account

It was strange to tell users they need to verify their account in order
to perform all available actions when they've already verified their
account.
This commit is contained in:
Javi Martín
2022-08-11 15:35:50 +02:00
parent 1ecd422f7f
commit 3f664e4ccd
3 changed files with 21 additions and 24 deletions

View File

@@ -1,22 +1,18 @@
<div class="verification-info">
<p>
<%= t("account.show.user_permission_verify") %>
</p>
<div class="verify-account">
<% if account.level_three_verified? %>
<p class="already-verified">
<span class="icon-check"></span>
<%= t("account.show.verified_account") %>
</p>
<% else %>
<p>
<%= t("account.show.user_permission_verify") %>
</p>
<% unless account.organization? %>
<div>
<span class="verify-account">
<% if account.level_three_verified? %>
<p class="already-verified">
<span class="icon-check"></span>
<%= t("account.show.verified_account") %>
</p>
<% elsif account.level_two_verified? %>
<%= link_to t("account.show.finish_verification"), verification_path, class: "button success" %>
<% else %>
<%= link_to t("account.show.verify_my_account"), verification_path, class: "button success" %>
<% end %>
</span>
</div>
<% if account.level_two_verified? %>
<%= link_to t("account.show.finish_verification"), verification_path, class: "button success" %>
<% else %>
<%= link_to t("account.show.verify_my_account"), verification_path, class: "button success" %>
<% end %>
<% end %>
</div>

View File

@@ -4,4 +4,8 @@ class Account::VerifyAccountComponent < ApplicationComponent
def initialize(account)
@account = account
end
def render?
!account.organization?
end
end

View File

@@ -24,7 +24,7 @@ describe Account::VerifyAccountComponent do
render_inline Account::VerifyAccountComponent.new(account)
expect(page).to have_content "To perform all the actions verify your account."
expect(page).not_to have_content "To perform all the actions verify your account."
expect(page).to have_content "Account verified"
end
@@ -33,9 +33,6 @@ describe Account::VerifyAccountComponent do
render_inline Account::VerifyAccountComponent.new(account)
expect(page).to have_content "To perform all the actions verify your account."
expect(page).not_to have_link "Verify my account"
expect(page).not_to have_link "Complete verification"
expect(page).not_to have_content "Account verified"
expect(page).not_to be_rendered
end
end