diff --git a/app/controllers/votes_controller.rb b/app/controllers/votes_controller.rb index c270bcb1a..90dbab2c1 100644 --- a/app/controllers/votes_controller.rb +++ b/app/controllers/votes_controller.rb @@ -7,7 +7,14 @@ def create post = Post.find(params[:post_id]) if post.user == current_user && !SiteSetting['AllowSelfVotes'] - render(json: { status: 'failed', message: 'You may not vote on your own posts.' }, status: :forbidden) + render(json: { status: 'failed', message: I18n.t('votes.limits.own_post') }, + status: :forbidden) + return + end + + if !current_user.privilege?('unrestricted') && !current_user.owns_post_or_parent?(post) + render(json: { status: 'failed', message: I18n.t('votes.limits.restricted_ability') }, + status: :forbidden) return end diff --git a/config/locales/strings/en.votes.yml b/config/locales/strings/en.votes.yml index 485ef2f6f..4bd316b3e 100644 --- a/config/locales/strings/en.votes.yml +++ b/config/locales/strings/en.votes.yml @@ -1,4 +1,7 @@ en: votes: summary: - post_missing: 'Post not found' \ No newline at end of file + post_missing: 'Post not found' + limits: + own_post: 'You may not vote on your own posts.' + restricted_ability: 'You must have the Participate Everywhere ability to vote on this post.' \ No newline at end of file