posts: bring back uploader names.

This commit is contained in:
evazion
2020-07-13 18:19:20 -05:00
parent 45bbb71eba
commit 0b52b1622f
4 changed files with 9 additions and 19 deletions

View File

@@ -47,10 +47,6 @@ class PostPolicy < ApplicationPolicy
record.visible?(user) record.visible?(user)
end end
def can_view_uploader?
user.is_approver?
end
def can_lock_rating? def can_lock_rating?
user.is_builder? user.is_builder?
end end

View File

@@ -4,12 +4,10 @@
<strong>Date</strong> <strong>Date</strong>
<%= compact_time(post.created_at) %> <%= compact_time(post.created_at) %>
</span> </span>
<% if policy(post).can_view_uploader? %> <span class="info">
<span class="info"> <strong>Uploader</strong>
<strong>User</strong> <%= link_to_user(post.uploader) %>
<%= link_to_user(post.uploader) %> </span>
</span>
<% end %>
<span class="info"> <span class="info">
<strong>Rating</strong> <strong>Rating</strong>
<%= post.pretty_rating %> <%= post.pretty_rating %>

View File

@@ -1,11 +1,9 @@
<ul> <ul>
<li id="post-info-id">ID: <%= post.id %></li> <li id="post-info-id">ID: <%= post.id %></li>
<% if policy(post).can_view_uploader? %> <li id="post-info-uploader">
<li id="post-info-uploader"> Uploader: <%= link_to_user(post.uploader) %>
Uploader: <%= link_to_user(post.uploader) %> <%= link_to "»", posts_path(tags: "user:#{post.uploader.name}") %>
<%= link_to "»", posts_path(tags: "user:#{post.uploader.name}") %> </li>
</li>
<% end %>
<li id="post-info-date"> <li id="post-info-date">
Date: <%= link_to time_ago_in_words_tagged(post.created_at), posts_path(tags: "date:#{post.created_at.to_date}") %> Date: <%= link_to time_ago_in_words_tagged(post.created_at), posts_path(tags: "date:#{post.created_at.to_date}") %>
</li> </li>

View File

@@ -1,8 +1,6 @@
<div class="post-tooltip-header"> <div class="post-tooltip-header">
<span class="post-tooltip-header-left"> <span class="post-tooltip-header-left">
<% if policy(@post).can_view_uploader? %> <%= link_to_user @post.uploader %>
<%= link_to_user @post.uploader %>
<% end %>
<span class="post-tooltip-favorites post-tooltip-info"> <span class="post-tooltip-favorites post-tooltip-info">
<span><%= @post.fav_count %></span> <span><%= @post.fav_count %></span>