diff --git a/app/controllers/post_votes_controller.rb b/app/controllers/post_votes_controller.rb index 4cf3c05c6..88d81ecad 100644 --- a/app/controllers/post_votes_controller.rb +++ b/app/controllers/post_votes_controller.rb @@ -1,5 +1,5 @@ class PostVotesController < ApplicationController - before_filter :gold_only + before_filter :voter_only def create @post = Post.find(params[:post_id]) @@ -7,4 +7,10 @@ class PostVotesController < ApplicationController rescue PostVote::Error => x @error = x end + +protected + + def voter_only + CurrentUser.is_voter? + end end diff --git a/app/logical/anonymous_user.rb b/app/logical/anonymous_user.rb index a95e1c963..602da6f22 100644 --- a/app/logical/anonymous_user.rb +++ b/app/logical/anonymous_user.rb @@ -241,6 +241,14 @@ class AnonymousUser false end + def is_voter? + false + end + + def is_super_voter? + false + end + %w(member banned gold builder platinum janitor moderator admin).each do |name| define_method("is_#{name}?") do false diff --git a/app/models/user.rb b/app/models/user.rb index f719a8aa3..010fb75c3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -401,6 +401,10 @@ class User < ActiveRecord::Base level >= Levels::ADMIN end + def is_voter? + is_gold? || is_super_voter? + end + def create_mod_action if level_changed? ModAction.create(:description => %{"#{name}":/users/#{id} level changed #{level_string_was} -> #{level_string}}) diff --git a/app/views/comments/partials/index/_header.html.erb b/app/views/comments/partials/index/_header.html.erb index 472ec8a02..0e0e1ce02 100644 --- a/app/views/comments/partials/index/_header.html.erb +++ b/app/views/comments/partials/index/_header.html.erb @@ -16,7 +16,7 @@ Score <%= post.score %> - <% if CurrentUser.is_gold? %> + <% if CurrentUser.is_voter? %> (vote <%= link_to("up", post_votes_path(:score => "up", :post_id => post.id), :remote => true, :method => :post) %>/<%= link_to("down", post_votes_path(:score => "down", :post_id => post.id), :remote => true, :method => :post) %>) <% end %> diff --git a/app/views/posts/partials/show/_information.html.erb b/app/views/posts/partials/show/_information.html.erb index 26a280754..1749f5c92 100644 --- a/app/views/posts/partials/show/_information.html.erb +++ b/app/views/posts/partials/show/_information.html.erb @@ -16,7 +16,7 @@