Merge pull request #2924 from evazion/feat-hidden-notice

/posts: add notice when posts are hidden.
This commit is contained in:
Albert Yi
2017-03-20 12:30:15 -07:00
committed by GitHub
2 changed files with 24 additions and 0 deletions

View File

@@ -77,6 +77,18 @@ module PostSets
posts.any? {|x| x.rating == "e"}
end
def hidden_posts
posts.select { |p| !p.visible? }
end
def banned_posts
posts.select(&:is_banned?)
end
def censored_posts
hidden_posts - banned_posts
end
def use_sequential_paginator?
unknown_post_count? && !CurrentUser.is_gold?
end

View File

@@ -9,6 +9,18 @@
</div>
<% end %>
<% if post_set.hidden_posts.present? %>
<div class="tn hidden-posts-notice">
<% if post_set.banned_posts.present? %>
<%= post_set.banned_posts.size %> post(s) were removed from this page at the artist's request (<%= link_to "learn more", wiki_pages_path(title: "banned_artist") %>).
<% end %>
<% if post_set.censored_posts.present? %>
<%= post_set.censored_posts.size %> post(s) on this page require a <%= link_to "Gold account", new_user_upgrade_path %> to view (<%= link_to "learn more", wiki_pages_path(title: "help:censored_tags") %>).
<% end %>
</div>
<% end %>
<% unless @random.present? %>
<%= numbered_paginator(post_set.posts) %>
<% end %>