Unify the logic to show the "not allowed" message
We were using the same logic six times regarding when we should show a "participation not allowed" message. Since we're going to change the current behavior, we're unifying the logic in one place so the changes will be easier.
This commit is contained in:
@@ -7,24 +7,7 @@
|
||||
<%= t("proposals.proposal.votes", count: proposal.votes_score) %>
|
||||
</span>
|
||||
|
||||
<% if !current_user %>
|
||||
<div tabindex="0">
|
||||
<%= render "shared/login_to_vote" %>
|
||||
</div>
|
||||
<% elsif organization? %>
|
||||
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
|
||||
<p>
|
||||
<%= t("votes.organizations") %>
|
||||
</p>
|
||||
</div>
|
||||
<% elsif !can_vote? %>
|
||||
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
|
||||
<p>
|
||||
<%= sanitize(t("legislation.proposals.not_verified",
|
||||
verify_account: link_to_verify_account)) %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render Shared::ParticipationNotAllowedComponent.new(proposal, cannot_vote_text: cannot_vote_text) %>
|
||||
|
||||
<% if current_user&.voted_as_when_voted_for(proposal) && setting["twitter_handle"] %>
|
||||
<div class="share-supported">
|
||||
|
||||
@@ -12,7 +12,7 @@ class Legislation::Proposals::VotesComponent < ApplicationComponent
|
||||
proposal.votable_by?(current_user)
|
||||
end
|
||||
|
||||
def organization?
|
||||
current_user&.organization?
|
||||
def cannot_vote_text
|
||||
t("legislation.proposals.not_verified", verify_account: link_to_verify_account) unless can_vote?
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user