Skip to content

Commit

Permalink
Don't use last component group id for "other" section on subscription…
Browse files Browse the repository at this point in the history
… page

Otherwise this breaks then there aren't any component groups as it
cannot use the last value the var was assigned as it never happened. #8
  • Loading branch information
sedan07 committed Jan 28, 2021
1 parent 3947f0d commit 2df9220
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/SubscribeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function __construct(Guard $auth)
public function showSubscribe()
{
return View::make('subscribe.subscribe')
->withAboutApp(Markdown::convertToHtml(Config::get('setting.app_about')));
->withAboutApp(Markdown::convertToHtml(Config::get('setting.app_about', '')));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions resources/views/subscribe/manage.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
<div class="list-group-item group-name">
<strong>{{ trans('cachet.components.group.other') }}</strong>
<div class="pull-right text-muted small">
<a href="javascript: void(0);" class="select-group" id="select-all-{{$componentGroup->id}}">{{ trans('cachet.components.select_all') }}</a>
<a href="javascript: void(0);" class="select-group" id="select-all-ungrouped">{{ trans('cachet.components.select_all') }}</a>
&nbsp;|&nbsp;
<a href="javascript: void(0);" class="deselect-group" id="deselect-all-{{$componentGroup->id}}">{{ trans('cachet.components.deselect_all') }}</a>
<a href="javascript: void(0);" class="deselect-group" id="deselect-all-ungrouped">{{ trans('cachet.components.deselect_all') }}</a>
</div>
</div>
@foreach($ungroupedComponents as $component)
Expand Down
35 changes: 35 additions & 0 deletions tests/SmokeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\Setting;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Support\Facades\Notification;
use CachetHQ\Cachet\Notifications\Subscriber\VerifySubscriptionNotification;
use CachetHQ\Cachet\Models\Subscriber;
use Illuminate\Support\Facades\URL;

/**
* This is the smoke test class.
Expand Down Expand Up @@ -44,6 +48,37 @@ public function test_single_component_page()
$this->get('/incidents/1')->assertStatus(200);
}

/**
* Test the subscribe process works
*/
public function test_subscribe_page()
{
$this->configureApp();

Notification::fake();

$this->get('/subscribe')->assertStatus(200);

Notification::assertNothingSent();

$this->post('/subscribe', ['email' => '[email protected]'])->assertStatus(302);

$subscriber = Subscriber::where('email', '[email protected]')->first();

Notification::assertSentTo(
[$subscriber],
VerifySubscriptionNotification::class
);

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

$this->followingRedirects()->get($verify_route)->assertStatus(200);

# Subscriber should now be verified
$subscriber->refresh();
$this->assertEquals(true, $subscriber->getIsVerifiedAttribute());
}

public function test_dashboard_auth_page()
{
$this->configureApp();
Expand Down

0 comments on commit 2df9220

Please sign in to comment.