Skip to content

Commit

Permalink
Add paywall token synchronization when user is claimed
Browse files Browse the repository at this point in the history
remp/crm#1575
  • Loading branch information
rootpd committed Nov 10, 2020
1 parent 71ce0c9 commit e829338
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/model/User/UnclaimedUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,24 @@ class UnclaimedUser

private $usersRepository;

private $userData;

public function __construct(
AccessTokensRepository $accessTokensRepository,
DataProviderManager $dataProviderManager,
Emitter $emitter,
UserManager $userManager,
UserMetaRepository $userMetaRepository,
UsersRepository $usersRepository
UsersRepository $usersRepository,
UserData $userData
) {
$this->userManager = $userManager;
$this->userMetaRepository = $userMetaRepository;
$this->dataProviderManager = $dataProviderManager;
$this->accessTokensRepository = $accessTokensRepository;
$this->emitter = $emitter;
$this->usersRepository = $usersRepository;
$this->userData = $userData;
}

/**
Expand Down Expand Up @@ -123,6 +127,7 @@ public function claimUser(IRow $unclaimedUser, IRow $loggedUser, IRow $deviceTok
$this->userMetaRepository->add($unclaimedUser, self::CLAIMED_BY_KEY, $loggedUser->id);
$this->userMetaRepository->add($loggedUser, self::CLAIMED_UNCLAIMED_USER_KEY, $unclaimedUser->id);

$this->userData->refreshUserTokens($loggedUser->id);
$this->emitter->emit(new UserClaimedEvent($unclaimedUser, $loggedUser, $deviceToken));
}

Expand Down

0 comments on commit e829338

Please sign in to comment.