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

Solve intermittent bug where form permissions are not applied for new forms #2470

Merged
merged 6 commits into from
Aug 17, 2023

Conversation

kelvin-muchiri
Copy link
Contributor

@kelvin-muchiri kelvin-muchiri commented Aug 15, 2023

Changes / Features implemented

Django post_save signal is run at the end of of the Model.save() method. It is not guaranteed that the transaction will have commited at this time. This leads to situation where XForm.DoesNotExist exception is at times raised when a new form is created which results in users not having the correct permissions for some forms despite having the appropriate roles

Use transaction.on_commit to ensure set_project_perms_to_xform_async.delay in the post_save signal is only called after the transaction is successful

Adjust failing tests to accommodate the new change

Steps taken to verify this change does what is intended

  • QA

Side effects of implementing this change

No side effects

Before submitting this PR for review, please make sure you have:

  • Included tests
  • Updated documentation

Closes #

Django post_save signal is run at the end of of the Model.save() method. It is not guaranteed that the transaction will have commited. This leads to situation where XForm.DoesNotExist exception is at times raised when a new form is created
@kelvin-muchiri kelvin-muchiri marked this pull request as ready for review August 17, 2023 08:10
@kelvin-muchiri kelvin-muchiri changed the title Solve intermittent bug where form permissions are not applied Solve intermittent bug where form permissions are not applied for new forms Aug 17, 2023
@kelvin-muchiri kelvin-muchiri merged commit 88f3b00 into main Aug 17, 2023
10 checks passed
@kelvin-muchiri kelvin-muchiri deleted the bug-xform-permissions-not-applied branch August 17, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants