diff --git a/app/models/story.rb b/app/models/story.rb index cca6042..9cb9a14 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -225,6 +225,11 @@ class Story < ActiveRecord::Base "hotness = '#{self.calculated_hotness}' WHERE id = #{self.id.to_i}") end + def hider_count + @hider_count ||= Vote.where(:story_id => self.id, :comment_id => nil, + :vote => 0).count + end + def is_editable_by_user?(user) if user && user.is_moderator? return true diff --git a/app/views/stories/_listdetail.html.erb b/app/views/stories/_listdetail.html.erb index 4db3218..be903c9 100644 --- a/app/views/stories/_listdetail.html.erb +++ b/app/views/stories/_listdetail.html.erb @@ -71,6 +71,9 @@ class="story <%= story.vote == 1 ? "upvoted" : "" %> <%= story.vote == -1 ? | <%= link_to "hide", story_hide_url(story.short_id), :class => "hider" %> <% end %> + <% if defined?(single_story) && single_story && story.hider_count > 0 %> + (hidden by <%= pluralize(story.hider_count, "user") %>) + <% end %> <% end %> <% if !story.is_gone? && (@user || story.comments_count > 0) %>