Skip to content

Commit

Permalink
Merge pull request #28 from fiveai/22-verify-or-manage-subscription-e…
Browse files Browse the repository at this point in the history
…mail

Only send verify OR manage subscription email to new subscribers #22
  • Loading branch information
sedan07 authored Feb 8, 2021
2 parents ac36057 + a76e7c3 commit 747d52e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Http/Controllers/SubscribeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ public function postSubscribe()
->withErrors($e->getMessageBag());
}

// Send the subscriber a link to manage their subscription.
$subscription->notify(new ManageSubscriptionNotification());
if ($verified) {
// Send the subscriber a link to manage their subscription.
$subscription->notify(new ManageSubscriptionNotification());
}

return redirect()->back()->withSuccess(
sprintf(
Expand Down
5 changes: 5 additions & 0 deletions tests/SmokeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Support\Facades\Notification;
use CachetHQ\Cachet\Notifications\Subscriber\VerifySubscriptionNotification;
use CachetHQ\Cachet\Notifications\Subscriber\ManageSubscriptionNotification;
use CachetHQ\Cachet\Models\Subscriber;
use Illuminate\Support\Facades\URL;

Expand Down Expand Up @@ -69,6 +70,10 @@ public function test_subscribe_page()
[$subscriber],
VerifySubscriptionNotification::class
);
Notification::assertNotSentTo(
[$subscriber],
ManageSubscriptionNotification::class
);

$verify_route = URL::signedRoute(cachet_route_generator('subscribe.verify'), ['code' => $subscriber->verify_code]);

Expand Down

0 comments on commit 747d52e

Please sign in to comment.