Merge pull request #5036 from consul/author_lock

Simplify locking current user when voting
This commit is contained in:
Javi Martín
2022-12-12 11:47:30 +01:00
committed by GitHub
2 changed files with 1 additions and 2 deletions

View File

@@ -38,7 +38,6 @@ class Poll::Answer < ApplicationRecord
def max_votes
return if !question || question&.unique? || persisted?
author.reload
author.lock!
if question.answers.by_author(author).count >= question.max_votes

View File

@@ -339,7 +339,7 @@ class User < ApplicationRecord
end
def locale
self[:locale] ||= I18n.default_locale.to_s
self[:locale] || I18n.default_locale.to_s
end
def confirmation_required?