mirror of
https://github.com/cachethq/cachet.git
synced 2026-03-06 20:57:01 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e5e8b1545 | ||
|
|
7e556d5dba | ||
|
|
331e176fbc | ||
|
|
bde0abe472 | ||
|
|
f2bf2eff68 | ||
|
|
50ab96fc4f | ||
|
|
3cbee1302e |
@@ -44,17 +44,17 @@ class SubscribeSubscriberCommandHandler
|
||||
|
||||
// Decide what to subscribe the subscriber to.
|
||||
if ($subscriptions = $command->subscriptions) {
|
||||
$subscriptions = Component::whereIn('id', $subscriptions);
|
||||
$components = Component::whereIn('id', $subscriptions)->get();
|
||||
} else {
|
||||
$subscriptions = Component::all();
|
||||
$components = Component::all();
|
||||
}
|
||||
|
||||
foreach ($subscriptions as $component) {
|
||||
$components->map(function ($component) use ($subscriber) {
|
||||
Subscription::create([
|
||||
'subscriber_id' => $subscriber->id,
|
||||
'component_id' => $component->id,
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
if ($command->verified) {
|
||||
dispatch(new VerifySubscriberCommand($subscriber));
|
||||
@@ -62,6 +62,8 @@ class SubscribeSubscriberCommandHandler
|
||||
event(new SubscriberHasSubscribedEvent($subscriber));
|
||||
}
|
||||
|
||||
$subscriber->load('subscriptions');
|
||||
|
||||
return $subscriber;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace CachetHQ\Cachet\Bus\Handlers\Commands\Subscriber;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\Subscriber\UnsubscribeSubscriberCommand;
|
||||
use CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasUnsubscribedEvent;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
|
||||
class UnsubscribeSubscriberCommandHandler
|
||||
{
|
||||
|
||||
796
composer.lock
generated
796
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -82,6 +82,7 @@ class SubscriberTest extends AbstractApiTestCase
|
||||
$this->assertResponseOk();
|
||||
$this->seeHeader('Content-Type', 'application/json');
|
||||
$this->seeJson(['email' => 'support@alt-three.com']);
|
||||
$this->seeJsonStructure(['data' => ['subscriptions' => []]]);
|
||||
}
|
||||
|
||||
public function testDeleteSubscriber()
|
||||
|
||||
Reference in New Issue
Block a user