Skip to content

Commit

Permalink
chore: upgrade version to 4.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
brobro10000 committed May 7, 2024
1 parent 12b4e9f commit d651d54
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions enterprise/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,18 @@ def send_sso_configured_email(
raise exc


def _recipients_for_identified_users(user_id_by_email):
braze_client_instance = BrazeAPIClient()
recipients = []
for user_id_by_email_chunk in batch_dict(user_id_by_email, MAX_NUM_IDENTIFY_USERS_ALIASES):
recipients_by_email = braze_client_instance.create_recipients(
alias_label=ENTERPRISE_BRAZE_ALIAS_LABEL,
user_id_by_email=user_id_by_email_chunk
)
recipients.extend(recipients_by_email.values())
return recipients


@shared_task
@set_code_owner_attribute
def send_group_membership_invitation_notification(
Expand Down Expand Up @@ -260,13 +272,7 @@ def send_group_membership_invitation_notification(
[pecu_emails],
ENTERPRISE_BRAZE_ALIAS_LABEL,
)
for user_id_by_email_chunk in batch_dict(user_id_by_email, MAX_NUM_IDENTIFY_USERS_ALIASES):
recipients_by_email = braze_client_instance.create_recipients(
alias_label=ENTERPRISE_BRAZE_ALIAS_LABEL,
user_id_by_email=user_id_by_email_chunk
)
for _, recipient in recipients_by_email.items():
recipients.append(recipient)
recipients.extend(_recipients_for_identified_users(user_id_by_email))
try:
braze_client_instance.send_campaign_message(
settings.BRAZE_GROUPS_INVITATION_EMAIL_CAMPAIGN_ID,
Expand Down Expand Up @@ -321,13 +327,7 @@ def send_group_membership_removal_notification(enterprise_customer_uuid, members
[pecu_emails],
ENTERPRISE_BRAZE_ALIAS_LABEL,
)
for user_id_by_email_chunk in batch_dict(user_id_by_email, MAX_NUM_IDENTIFY_USERS_ALIASES):
recipients_by_email = braze_client_instance.create_recipients(
alias_label=ENTERPRISE_BRAZE_ALIAS_LABEL,
user_id_by_email=user_id_by_email_chunk
)
for _, recipient in recipients_by_email.items():
recipients.append(recipient)
recipients.extend(_recipients_for_identified_users(user_id_by_email))
try:
braze_client_instance.send_campaign_message(
settings.BRAZE_GROUPS_REMOVAL_EMAIL_CAMPAIGN_ID,
Expand Down

0 comments on commit d651d54

Please sign in to comment.