Don’t allow comments on questions for unverified users and when the phase is closed

This commit is contained in:
Amaia Castro
2017-02-08 18:19:10 +01:00
parent 60c7947cb4
commit 3009706b0d
13 changed files with 155 additions and 18 deletions

View File

@@ -13,14 +13,25 @@
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
<% if user_signed_in? %>
<%= render 'comments/form', {commentable: commentable, parent_id: nil, toggeable: false} %>
<% if comments_closed_for_commentable?(commentable) %>
<br>
<div data-alert class="callout primary">
<%= comments_closed_text(commentable) %>
</div>
<% elsif require_verified_resident_for_commentable?(commentable, current_user) %>
<br>
<div data-alert class="callout primary">
<%= t("comments.verified_only", verify_account: link_to(t("comments.verify_account"), verification_path )).html_safe %>
</div>
<% else %>
<%= render 'comments/form', {commentable: commentable, parent_id: nil, toggeable: false} %>
<% end %>
<% else %>
<br>
<div data-alert class="callout primary">
<%= t("debates.show.login_to_comment",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
<br>
<div data-alert class="callout primary">
<%= t("debates.show.login_to_comment",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div>
<% end %>