Skip to content
Snippets Groups Projects
Commit f5047618 authored by luap42's avatar luap42 Committed by ArtOfCode-
Browse files

Fixing meta/277029

parent 2e85331d
Branches
Tags
No related merge requests found
......@@ -13,6 +13,7 @@ class VotesController < ApplicationController
recent_votes = Vote.where(created_at: 24.hours.ago..Time.now, user: current_user).count
max_votes_per_day = SiteSetting['FreeVotes'] + (@current_user.reputation - SiteSetting['NewUserInitialRep'])
unless post&.parent&.user&.id == current_user.id
if recent_votes >= max_votes_per_day
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.'
......@@ -24,6 +25,7 @@ class VotesController < ApplicationController
render json: { status: 'failed', message: vote_limit_msg }, status: 403
return
end
end
destroyed = post.votes.where(user: current_user).destroy_all
vote = post.votes.create(user: current_user, vote_type: params[:vote_type].to_i, recv_user: post.user)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment