hide forum votes if the request is not pending

This commit is contained in:
Albert Yi
2018-05-11 17:05:26 -07:00
parent b31166a5e2
commit 9310b39fda
7 changed files with 54 additions and 6 deletions

View File

@@ -11,6 +11,6 @@
<%= render "forum_post_votes/vote", vote: vote, forum_post: forum_post %>
<% end %>
<% if !votes.by(CurrentUser.user.id).exists? %>
<% if forum_post.tag_change_request.is_pending? && !votes.by(CurrentUser.user.id).exists? %>
<%= render "forum_post_votes/add_vote", vote: votes.by(CurrentUser.user.id).first, forum_post: forum_post %>
<% end %>
<% end %>

View File

@@ -4,7 +4,7 @@
%>
<li class="vote-score-<%= vote.vote_type %>">
<% if vote.creator_id == CurrentUser.id %>
<% if forum_post.tag_change_request.is_pending? && vote.creator_id == CurrentUser.id %>
<%= link_to content_tag(:i, nil, class: "far #{vote.fa_class}"), forum_post_votes_path(forum_post_id: forum_post.id, format: "js"), remote: true, method: :delete %>
<%= link_to_user vote.creator %>
<% else %>