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

Refactor and ensure all waffle flags to include a request object #2647

Closed
4 tasks
zandercymatics opened this issue Aug 23, 2024 · 0 comments · Fixed by #2834
Closed
4 tasks

Refactor and ensure all waffle flags to include a request object #2647

zandercymatics opened this issue Aug 23, 2024 · 0 comments · Fixed by #2834
Assignees

Comments

@zandercymatics
Copy link
Contributor

zandercymatics commented Aug 23, 2024

Issue description

A few of our flag_is_active checks are passing in "None" for the underlying HttpRequest object. This is because the request isn't accessible in the context that it is being used in.

However, doing so breaks some functionality. All instances of these should be refactored such that we are now passing in a HttpRequest object

Acceptance criteria

  • All checks using flag_is_active for "disable_email_sending" pass in a request object
  • Double check that all of our checks for "organization_feature" pass in a request object
  • Double check that all of our checks for "multiple_portfolios" pass in a request object

Additional context

One approach to this may be to create a bogus request and pass it to the user context. However, this would need to be tested thoroughly.

request = HttpRequest()
request.user = self.user
flag_is_active(request, "profile_feature")

An alternative would be to write a custom function in WaffleFlags that essentially does what flag_is_active does, but it takes the user and the flag name rather than the request and the flag name.

If you decide to go this route, remember to also refactor the other bogus requests created for our organization_feature flag

Links to other issues

@abroddrick abroddrick changed the title Refactor waffle flags "profile_feature" and "disable_email_sending" to include a request object Refactor and ensure all waffle flags to include a request object Aug 29, 2024
@dave-kennedy-ecs dave-kennedy-ecs self-assigned this Sep 17, 2024
dave-kennedy-ecs added a commit that referenced this issue Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants