Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify locking current user when voting #5036

Merged
merged 1 commit into from
Dec 12, 2022
Merged

Simplify locking current user when voting #5036

merged 1 commit into from
Dec 12, 2022

Commits on Nov 29, 2022

  1. Simplify locking current user when voting

    Back in commit 36e4524, we wrote:
    
    > The `reload` method added to max_votes validation is needed because
    > the author gets here with some changes because of the around_action
    > `switch_locale`, which adds some changes to the current user record
    > and therefore, the lock method raises an exception when trying to lock
    > it requiring us to save or discard those record changes.
    
    This happened when `current_user` didn't have a locale stored in the
    database and the `current_locale` method returned the default locale.
    And the test "Poll Votation Type Multiple answers" would indeed fail if
    we removed the `reload` method. However, we can remove the need to
    reload the record by avoiding the mentioned changes on the current user
    record.
    
    So we're changing the `User#locale` method so it doesn't modify the user
    record.
    javierm committed Nov 29, 2022
    Configuration menu
    Copy the full SHA
    4355138 View commit details
    Browse the repository at this point in the history