Skip to content

Commit

Permalink
Merge pull request #23 from SpearDevs/extend-usersubscription
Browse files Browse the repository at this point in the history
Extend usersubscription
  • Loading branch information
TomaszLach2 authored Aug 7, 2023
2 parents df8f1b3 + 2f33b0f commit 241a9be
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class extends Controller {

this.handleValueChange();

this.receiverInput.addEventListener('input', () => {
this.receiverInput.addEventListener('change', () => {
this.handleValueChange();
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/SendPushNotificationAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __invoke(Request $request): Response
$pushContent = $data['body'] ?? '';
$customerGroup = $data['groups']?->getName() ?? '';
$receiver = $data['receiver'] ?? '';
$user = $data['user']?->getEmail() ?? '';
$user = $data['user']?->getUsername() ?? '';

$this->channelContext->setChannelCode($data['channel']->getCode());

Expand Down
11 changes: 5 additions & 6 deletions src/Repository/MySQLUserSubscriptionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function getSubscriptionsForUsersInGroup(string $groupName, ChannelInterf
public function getSubscriptionsForUserByEmail(string $email, ChannelInterface $channel): iterable
{
return $this->getQueryToGetUserSubscriptions()
->where('user.username = :email')
->where('customer.email = :email')
->setParameter('email', $email)
->andWhere('userSubscription.channel = :channel')
->setParameter('channel', $channel)
Expand All @@ -47,12 +47,11 @@ private function getQueryToGetUserSubscriptions(): QueryBuilder
return $this->createQueryBuilder('userSubscription')
->select('userSubscription')
->leftJoin(
'userSubscription.user',
'user',
'userSubscription.customer',
'customer',
'WITH',
'user.id = userSubscription.user',
'customer.id = userSubscription.customer',
)
->where('userSubscription.user is not null')
->join('user.customer', 'customer');
->where('userSubscription.customer is not null');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class extends Controller {

this.handleValueChange();

this.receiverInput.addEventListener('input', () => {
this.receiverInput.addEventListener('change', () => {
this.handleValueChange();
});
}
Expand Down

0 comments on commit 241a9be

Please sign in to comment.