[Forum Votes] Fix inverted logic + raise limit + error reporting

This commit is contained in:
Kira 2021-03-11 11:28:43 -08:00
parent 8ea9419045
commit ec53c66230
3 changed files with 3 additions and 2 deletions

View File

@ -7,6 +7,7 @@ class ForumPostVotesController < ApplicationController
def create
@forum_post_vote = @forum_post.votes.create(forum_post_vote_params)
raise User::PrivilegeError.new(@forum_post_vote.errors.full_messages.join('; ')) if @forum_post_vote.errors.size > 0
respond_with(@forum_post_vote) do |fmt|
fmt.json { render json: @forum_post_vote, code: 201 }
end

View File

@ -533,7 +533,7 @@ class User < ApplicationRecord
:general_bypass_throttle?, 3.days)
create_user_throttle(:suggest_tag, -> { Danbooru.config.tag_suggestion_limit - (TagAlias.for_creator(id).where("created_at > ?", 1.hour.ago).count + TagImplication.for_creator(id).where("created_at > ?", 1.hour.ago).count + BulkUpdateRequest.for_creator(id).where("created_at > ?", 1.hour.ago).count) },
:is_janitor?, 7.days)
create_user_throttle(:forum_vote, -> { Danbooru.config.forum_vote_limit - ForumPostVote.by(id).where("created_at < ?", 1.hour.ago).count },
create_user_throttle(:forum_vote, -> { Danbooru.config.forum_vote_limit - ForumPostVote.by(id).where("created_at > ?", 1.hour.ago).count },
:is_janitor?, 3.days)
def can_remove_from_pools?

View File

@ -219,7 +219,7 @@ fart'
end
def forum_vote_limit
30
50
end
# Blips created in the last hour