diff --git a/app/controllers/votes_controller.rb b/app/controllers/votes_controller.rb index f523c69b06814c745ef588cc190b9056d6fb7b06..f26a0c8d2cadb8e5cd79ec28030193ce6c1d2c5b 100644 --- a/app/controllers/votes_controller.rb +++ b/app/controllers/votes_controller.rb @@ -14,7 +14,13 @@ class VotesController < ApplicationController max_votes_per_day = SiteSetting['FreeVotes'] + (@current_user.reputation - SiteSetting['NewUserInitialRep']) if recent_votes >= max_votes_per_day - vote_limit_msg = 'You have used your daily vote limit: ' + recent_votes.to_s + '/' + max_votes_per_day.to_s + vote_limit_msg = 'You have used your daily vote limit of ' + recent_votes.to_s + 'votes. Gain more reputation or' \ + ' come back tomorrow to continue voting.' + + if max_votes_per_day <= 0 + vote_limit_msg = 'You need to gain some reputation on this site before you can start voting.' + end + render json: { status: 'failed', message: vote_limit_msg }, status: 403 return end