Skip to content

Commit

Permalink
Hide moderation for non-moderators. Close #240.
Browse files Browse the repository at this point in the history
Also test this to try and prevent it from sneaking in again.
  • Loading branch information
bamnet committed Nov 28, 2012
1 parent c8d17fa commit 9521940
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/submissions/_submission_listgriditem.html.erb
Expand Up @@ -13,7 +13,7 @@
<% end -%>
</p>

<% unless submission.content.is_expired? %>
<% if can?(:update, submission) && !submission.content.is_expired? %>
<p>
<%= link_to t(:moderate), "#", :class => "btn small dropdown-control dd-moderate", :title => t(:moderate_title, :name => submission.content.name), :rel => "#moderate_#{ submission.id }" %>
</p>
Expand Down
12 changes: 12 additions & 0 deletions test/functional/submissions_controller_test.rb
Expand Up @@ -12,4 +12,16 @@ def setup
assert_redirected_to feed_submissions_path(feeds(:boring_announcements))
end

test "show feed does not have moderation" do
get :index, :feed_id => feeds(:service).id
assert_select ".dd-moderate", 0
assert_select "button", 0
end

test "feed moderator sees moderation" do
sign_in users(:katie)
get :index, :feed_id => feeds(:service).id
assert_select ".dd-moderate", feeds(:service).submissions.active.count
end

end

0 comments on commit 9521940

Please sign in to comment.