Skip to content

Commit

Permalink
Trigger a sync when a new partner user is created
Browse files Browse the repository at this point in the history
  • Loading branch information
acasajus committed Oct 23, 2024
1 parent b34022a commit c3dbc8b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions app/account_linking.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ def ensure_partner_user_exists_for_user(
partner_email=link_request.email,
external_user_id=link_request.external_user_id,
)
Job.create(
name=config.JOB_SEND_ALIAS_CREATION_EVENTS,
payload={"user_id": sl_user.id},
run_at=arrow.now(),
)
Session.commit()
LOG.i(
f"Created new partner_user for partner:{partner.id} user:{sl_user.id} external_user_id:{link_request.external_user_id}. PartnerUser.id is {res.id}"
Expand Down Expand Up @@ -165,7 +170,6 @@ def process(self) -> LinkResult:
self.link_request.plan,
)
Session.commit()
self._initial_alias_sync(new_user)

if not new_user.created_by_partner:
send_welcome_email(new_user)
Expand All @@ -177,14 +181,6 @@ def process(self) -> LinkResult:
strategy=self.__class__.__name__,
)

def _initial_alias_sync(self, user: User):
Job.create(
name=config.JOB_SEND_ALIAS_CREATION_EVENTS,
payload={"user_id": user.id},
run_at=arrow.now(),
commit=True,
)


class ExistingUnlinkedUserStrategy(ClientMergeStrategy):
def process(self) -> LinkResult:
Expand Down

0 comments on commit c3dbc8b

Please sign in to comment.