mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 18:09:25 +02:00
Use regular flag_is_active
This commit is contained in:
parent
52ae6719b5
commit
b45d5cebbc
2 changed files with 3 additions and 11 deletions
|
@ -10,7 +10,7 @@ from django.utils import timezone
|
|||
from waffle import flag_is_active
|
||||
from registrar.models.domain import Domain
|
||||
from registrar.models.federal_agency import FederalAgency
|
||||
from registrar.models.utility.generic_helper import CreateOrUpdateOrganizationTypeHelper, flag_is_active_for_user
|
||||
from registrar.models.utility.generic_helper import CreateOrUpdateOrganizationTypeHelper
|
||||
from registrar.utility.errors import FSMDomainRequestError, FSMErrorCodes
|
||||
from registrar.utility.constants import BranchChoices
|
||||
|
||||
|
@ -681,9 +681,8 @@ class DomainRequest(TimeStampedModel):
|
|||
wrap_email: bool -> Wraps emails using `wrap_text_and_preserve_paragraphs` if any given
|
||||
paragraph exceeds our desired max length (for prettier display).
|
||||
"""
|
||||
# This is a chicken or egg kind of problem. We don't have the request -- how do we know
|
||||
# to use either the creator or the submitter in this scenario?
|
||||
recipient = self.creator if flag_is_active_for_user(self.creator, "profile_feature") else self.submitter
|
||||
|
||||
recipient = self.creator if flag_is_active(None, "profile_feature") else self.submitter
|
||||
if recipient is None or recipient.email is None:
|
||||
logger.warning(f"Cannot send {new_status} email, no creator email address.")
|
||||
return None
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
import time
|
||||
import logging
|
||||
from urllib.parse import urlparse, urlunparse, urlencode
|
||||
from waffle import get_waffle_flag_model
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -322,9 +321,3 @@ def convert_queryset_to_dict(queryset, is_model=True, key="id"):
|
|||
request_dict = {value[key]: value for value in queryset}
|
||||
|
||||
return request_dict
|
||||
|
||||
|
||||
def flag_is_active_for_user(user, flag_name: str) -> bool | None:
|
||||
"""Given a user, returns if said user has the given flag permission or not"""
|
||||
flag = get_waffle_flag_model().get(flag_name)
|
||||
return flag.is_active_for_user(user)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue