Merge pull request #2295 from CachetHQ/new-notifications

Notifications
This commit is contained in:
James Brooks
2017-01-04 21:34:51 +00:00
committed by GitHub
61 changed files with 1549 additions and 1131 deletions

View File

@@ -32,3 +32,7 @@ REDIS_DATABASE=null
REDIS_PORT=null
GITHUB_TOKEN=null
NEXMO_KEY=null
NEXMO_SECRET=null
NEXMO_SMS_FROM=Cachet

View File

@@ -1,41 +0,0 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Commands\System\Mail;
use CachetHQ\Cachet\Models\User;
/**
* This is the test mail command class.
*
* @author James Brooks <james@alt-three.com>
*/
final class TestMailCommand
{
/**
* The user to send the notification to.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* Create a new test mail command.
*
* @param \CachetHQ\Cachet\Models\User $user
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
}

View File

@@ -22,15 +22,24 @@ final class IncidentWasReportedEvent implements IncidentEventInterface
*/
public $incident;
/**
* Whether to notify that the incident was reported.
*
* @var bool
*/
public $notify;
/**
* Create a new incident has reported event instance.
*
* @param \CachetHQ\Cachet\Models\Incident $incident
* @param bool $notify
*
* @return void
*/
public function __construct(Incident $incident)
public function __construct(Incident $incident, $notify = false)
{
$this->incident = $incident;
$this->notify = $notify;
}
}

View File

@@ -0,0 +1,51 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Models\Invite;
use CachetHQ\Cachet\Models\User;
/**
* This is the user accepted invite event class.
*
* @author James Brooks <james@alt-three.com>
*/
final class UserAcceptedInviteEvent implements UserEventInterface
{
/**
* The user that accepted the invite.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;
/**
* The invite that the user accepted.
*
* @var \CachetHQ\Cachet\Models\Invite
*/
public $invite;
/**
* Create a new user accepted invite event class.
*
* @param \CachetHQ\Cachet\Models\User $user
* @param \CachetHQ\Cachet\Models\Invite $invite
*
* @return void
*/
public function __construct(User $user, Invite $invite)
{
$this->user = $user;
$this->invite = $invite;
}
}

View File

@@ -105,9 +105,7 @@ class ReportIncidentCommandHandler
));
}
$incident->update(['notify' => (bool) $command->notify]);
event(new IncidentWasReportedEvent($incident));
event(new IncidentWasReportedEvent($incident, (bool) $command->notify));
return $incident;
}

View File

@@ -17,6 +17,7 @@ use CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasSubscribedEvent;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\Subscriber;
use CachetHQ\Cachet\Models\Subscription;
use CachetHQ\Cachet\Notifications\Subscriber\VerifySubscriptionNotification;
/**
* This is the subscribe subscriber command handler.
@@ -49,7 +50,7 @@ class SubscribeSubscriberCommandHandler
$components = Component::all();
}
$components->map(function ($component) use ($subscriber) {
$components->each(function ($component) use ($subscriber) {
Subscription::create([
'subscriber_id' => $subscriber->id,
'component_id' => $component->id,
@@ -59,9 +60,11 @@ class SubscribeSubscriberCommandHandler
if ($command->verified) {
dispatch(new VerifySubscriberCommand($subscriber));
} else {
event(new SubscriberHasSubscribedEvent($subscriber));
$subscriber->notify(new VerifySubscriptionNotification());
}
event(new SubscriberHasSubscribedEvent($subscriber));
$subscriber->load('subscriptions');
return $subscriber;

View File

@@ -1,64 +0,0 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Commands\System\Mail;
use CachetHQ\Cachet\Bus\Commands\System\Mail\TestMailCommand;
use Illuminate\Contracts\Mail\MailQueue;
/**
* This is the test mail command handler class.
*
* @author James Brooks <james@alt-three.com>
*/
class TestMailCommandHandler
{
/**
* The mailer instance.
*
* @var \Illuminate\Contracts\Mail\Mailer
*/
protected $mailer;
/**
* Create a test mail command handler.
*
* @param \Illuminate\Contracts\Mail\Mailer $mailer
*
* @return void
*/
public function __construct(MailQueue $mailer)
{
$this->mailer = $mailer;
}
/**
* Handle the test mail command.
*
* @param \CachetHQ\Cachet\Bus\Commands\System\Mail\TestMailCommand $command
*
* @return void
*/
public function handle(TestMailCommand $command)
{
$mail = [
'email' => $command->user->email,
'subject' => trans('dashboard.settings.mail.email.subject'),
];
$this->mailer->queue([
'html' => 'emails.system.test-html',
'text' => 'emails.system.test-text',
], $mail, function ($message) use ($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
}

View File

@@ -14,6 +14,7 @@ namespace CachetHQ\Cachet\Bus\Handlers\Commands\User;
use CachetHQ\Cachet\Bus\Commands\User\InviteUserCommand;
use CachetHQ\Cachet\Bus\Events\User\UserWasInvitedEvent;
use CachetHQ\Cachet\Models\Invite;
use CachetHQ\Cachet\Notifications\User\InviteUserNotification;
/**
* This is the invite user command handler.
@@ -36,6 +37,8 @@ class InviteUserCommandHandler
'email' => $email,
]);
$invite->notify(new InviteUserNotification());
event(new UserWasInvitedEvent($invite));
}
}

View File

@@ -14,18 +14,10 @@ namespace CachetHQ\Cachet\Bus\Handlers\Events\Component;
use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasUpdatedEvent;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\Subscriber;
use Illuminate\Contracts\Mail\MailQueue;
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
use CachetHQ\Cachet\Notifications\Component\ComponentStatusChangedNotification;
class SendComponentUpdateEmailNotificationHandler
{
/**
* The mailer instance.
*
* @var \Illuminate\Contracts\Mail\Mailer
*/
protected $mailer;
/**
* The subscriber instance.
*
@@ -36,14 +28,12 @@ class SendComponentUpdateEmailNotificationHandler
/**
* Create a new send incident email notification handler.
*
* @param \Illuminate\Contracts\Mail\Mailer $mailer
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return void
*/
public function __construct(MailQueue $mailer, Subscriber $subscriber)
public function __construct(Subscriber $subscriber)
{
$this->mailer = $mailer;
$this->subscriber = $subscriber;
}
@@ -66,9 +56,9 @@ class SendComponentUpdateEmailNotificationHandler
// First notify all global subscribers.
$globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get();
foreach ($globalSubscribers as $subscriber) {
$this->notify($component, $subscriber);
}
$globalSubscribers->each(function ($subscriber) use ($component, $event) {
$subscriber->notify(new ComponentStatusChangedNotification($component, $event->new_status));
});
$notified = $globalSubscribers->pluck('id')->all();
@@ -81,37 +71,8 @@ class SendComponentUpdateEmailNotificationHandler
return in_array($subscriber->id, $notified);
});
foreach ($componentSubscribers as $subscriber) {
$this->notify($component, $subscriber);
}
}
/**
* Send notification to subscriber.
*
* @param \CachetHQ\Cachet\Models\Component $component
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function notify(Component $component, Subscriber $subscriber)
{
$component = AutoPresenter::decorate($component);
$mail = [
'subject' => trans('cachet.subscriber.email.component.subject'),
'component_name' => $component->name,
'component_human_status' => $component->human_status,
];
$mail['email'] = $subscriber->email;
$mail['manage_link'] = cachet_route('subscribe.manage', [$subscriber->verify_code]);
$this->mailer->queue([
'html' => 'emails.components.update-html',
'text' => 'emails.components.update-text',
], $mail, function ($message) use ($mail) {
$message->to($mail['email'])->subject($mail['subject']);
$componentSubscribers->each(function ($subscriber) use ($component, $event) {
$subscriber->notify(new ComponentStatusChangedNotification($component, $event->new_status));
});
}
}

View File

@@ -13,19 +13,10 @@ namespace CachetHQ\Cachet\Bus\Handlers\Events\Incident;
use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasReportedEvent;
use CachetHQ\Cachet\Models\Subscriber;
use Illuminate\Contracts\Mail\MailQueue;
use Illuminate\Mail\Message;
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
use CachetHQ\Cachet\Notifications\Incident\NewIncidentNotification;
class SendIncidentEmailNotificationHandler
{
/**
* The mailer instance.
*
* @var \Illuminate\Contracts\Mail\Mailer
*/
protected $mailer;
/**
* The subscriber instance.
*
@@ -36,14 +27,12 @@ class SendIncidentEmailNotificationHandler
/**
* Create a new send incident email notification handler.
*
* @param \Illuminate\Contracts\Mail\Mailer $mailer
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return void
*/
public function __construct(MailQueue $mailer, Subscriber $subscriber)
public function __construct(Subscriber $subscriber)
{
$this->mailer = $mailer;
$this->subscriber = $subscriber;
}
@@ -56,23 +45,25 @@ class SendIncidentEmailNotificationHandler
*/
public function handle(IncidentWasReportedEvent $event)
{
if (!$event->incident->notify) {
$incident = $event->incident;
if (!$event->notify) {
return false;
}
// Only send emails for public incidents.
if ($event->incident->visible === 0) {
if (!$incident->visible) {
return;
}
// First notify all global subscribers.
$globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get();
foreach ($globalSubscribers as $subscriber) {
$this->notify($event, $subscriber);
}
$globalSubscribers->each(function ($subscriber) use ($incident) {
$subscriber->notify(new NewIncidentNotification($incident));
});
if (!$event->incident->component) {
if (!$incident->component) {
return;
}
@@ -81,53 +72,12 @@ class SendIncidentEmailNotificationHandler
// Notify the remaining component specific subscribers.
$componentSubscribers = $this->subscriber
->isVerified()
->forComponent($event->incident->component->id)
->forComponent($incident->component->id)
->get()
->reject(function ($subscriber) use ($notified) {
return in_array($subscriber->id, $notified);
})->each(function ($subscriber) use ($incident) {
$subscriber->notify(new NewIncidentNotification($incident));
});
foreach ($componentSubscribers as $subscriber) {
$this->notify($event, $subscriber);
}
}
/**
* Send notification to subscriber.
*
* @param \CachetHQ\Cachet\Bus\Events\IncidentWasReportedEvent $event
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function notify(IncidentWasReportedEvent $event, $subscriber)
{
$incident = AutoPresenter::decorate($event->incident);
$component = AutoPresenter::decorate($event->incident->component);
$mail = [
'email' => $subscriber->email,
'subject' => trans('cachet.subscriber.email.incident.subject', [
'status' => $incident->human_status,
'name' => $incident->name,
]),
'has_component' => ($event->incident->component) ? true : false,
'component_name' => $component ? $component->name : null,
'name' => $incident->name,
'timestamp' => $incident->occurred_at_formatted,
'status' => $incident->human_status,
'html_content' => $incident->formatted_message,
'text_content' => $incident->message,
'token' => $subscriber->token,
'manage_link' => cachet_route('subscribe.manage', [$subscriber->verify_code]),
'unsubscribe_link' => cachet_route('subscribe.unsubscribe', [$subscriber->verify_code]),
];
$this->mailer->queue([
'html' => 'emails.incidents.new-html',
'text' => 'emails.incidents.new-text',
], $mail, function (Message $message) use ($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
}

View File

@@ -0,0 +1,80 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Events\IncidentUpdate;
use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasReportedEvent;
use CachetHQ\Cachet\Models\Subscriber;
use CachetHQ\Cachet\Notifications\IncidentUpdate\IncidentUpdatedNotification;
class SendIncidentUpdateEmailNotificationHandler
{
/**
* The subscriber instance.
*
* @var \CachetHQ\Cachet\Models\Subscriber
*/
protected $subscriber;
/**
* Create a new send incident email notification handler.
*
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return void
*/
public function __construct(Subscriber $subscriber)
{
$this->subscriber = $subscriber;
}
/**
* Handle the event.
*
* @param \CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasReportedEvent $event
*
* @return void
*/
public function handle(IncidentUpdateWasReportedEvent $event)
{
$update = $event->update;
$incident = $update->incident;
// Only send emails for public incidents.
if (!$incident->visible) {
return;
}
// First notify all global subscribers.
$globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get();
$globalSubscribers->each(function ($subscriber) use ($update) {
$subscriber->notify(new IncidentUpdatedNotification($update));
});
if (!$incident->component) {
return;
}
$notified = $globalSubscribers->pluck('id')->all();
// Notify the remaining component specific subscribers.
$componentSubscribers = $this->subscriber
->isVerified()
->forComponent($incident->component->id)
->get()
->reject(function ($subscriber) use ($notified) {
return in_array($subscriber->id, $notified);
})->each(function ($subscriber) use ($incident) {
$subscriber->notify(new IncidentUpdatedNotification($incident));
});
}
}

View File

@@ -13,9 +13,7 @@ namespace CachetHQ\Cachet\Bus\Handlers\Events\Schedule;
use CachetHQ\Cachet\Bus\Events\Schedule\ScheduleEventInterface;
use CachetHQ\Cachet\Models\Subscriber;
use Illuminate\Contracts\Mail\MailQueue;
use Illuminate\Mail\Message;
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
use CachetHQ\Cachet\Notifications\Schedule\NewScheduleNotification;
/**
* This is the send schedule event notification handler.
@@ -24,13 +22,6 @@ use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
*/
class SendScheduleEmailNotificationHandler
{
/**
* The mailer instance.
*
* @var \Illuminate\Contracts\Mail\MailQueue
*/
protected $mailer;
/**
* The subscriber instance.
*
@@ -39,16 +30,14 @@ class SendScheduleEmailNotificationHandler
protected $subscriber;
/**
* Create a new send maintenance email notification handler.
* Create a new send schedule email notification handler.
*
* @param \Illuminate\Contracts\Mail\Mailer $mailer
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return void
*/
public function __construct(MailQueue $mailer, Subscriber $subscriber)
public function __construct(Subscriber $subscriber)
{
$this->mailer = $mailer;
$this->subscriber = $subscriber;
}
@@ -61,62 +50,11 @@ class SendScheduleEmailNotificationHandler
*/
public function handle(ScheduleEventInterface $event)
{
$schedule = $event->schedule;
// First notify all global subscribers.
$globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get();
foreach ($globalSubscribers as $subscriber) {
$this->notify($event, $subscriber);
}
$notified = $globalSubscribers->pluck('id')->all();
// Notify the remaining component specific subscribers.
$componentSubscribers = $this->subscriber
->isVerified()
->forComponent($event->incident->component->id)
->get()
->reject(function ($subscriber) use ($notified) {
return in_array($subscriber->id, $notified);
});
foreach ($componentSubscribers as $subscriber) {
$this->notify($event, $subscriber);
}
}
/**
* Send notification to subscriber.
*
* @param \CachetHQ\Cachet\Bus\Events\Schedule\ScheduleEventInterface $event
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function notify(ScheduleEventInterface $event, $subscriber)
{
$incident = AutoPresenter::decorate($event->incident);
$component = AutoPresenter::decorate($event->incident->component);
$mail = [
'email' => $subscriber->email,
'subject' => trans('cachet.subscriber.email.maintenance.subject', [
'name' => $incident->name,
]),
'name' => $incident->name,
'timestamp' => $incident->scheduled_at_formatted,
'status' => $incident->human_status,
'html_content' => $incident->formatted_message,
'text_content' => $incident->message,
'token' => $subscriber->token,
'manage_link' => cachet_route('subscribe.manage', [$subscriber->verify_code]),
'unsubscribe_link' => cachet_route('subscribe.unsubscribe', [$subscriber->verify_code]),
];
$this->mailer->queue([
'html' => 'emails.incidents.maintenance-html',
'text' => 'emails.incidents.maintenance-text',
], $mail, function (Message $message) use ($mail) {
$message->to($mail['email'])->subject($mail['subject']);
$globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get()->each(function ($subscriber) use ($schedule) {
$subscriber->notify(new NewScheduleNotification($schedule));
});
}
}

View File

@@ -1,61 +0,0 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Events\Subscriber;
use CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasSubscribedEvent;
use Illuminate\Contracts\Mail\MailQueue;
use Illuminate\Mail\Message;
class SendSubscriberVerificationEmailHandler
{
/**
* The mailer instance.
*
* @var \Illuminate\Contracts\Mail\MailQueue
*/
protected $mailer;
/**
* Create a new send subscriber verification email handler.
*
* @param \Illuminate\Contracts\Mail\Mailer $mailer
*
* @return void
*/
public function __construct(MailQueue $mailer)
{
$this->mailer = $mailer;
}
/**
* Handle the event.
*
* @param \CachetHQ\Cachet\Bus\Events\SubscriberHasSubscribedEvent $event
*
* @return void
*/
public function handle(SubscriberHasSubscribedEvent $event)
{
$mail = [
'email' => $event->subscriber->email,
'subject' => 'Confirm your subscription.',
'link' => cachet_route('subscribe.verify', ['code' => $event->subscriber->verify_code]),
];
$this->mailer->queue([
'html' => 'emails.subscribers.verify-html',
'text' => 'emails.subscribers.verify-text',
], $mail, function (Message $message) use ($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
}

View File

@@ -1,61 +0,0 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Bus\Handlers\Events\User;
use CachetHQ\Cachet\Bus\Events\User\UserWasInvitedEvent;
use Illuminate\Contracts\Mail\MailQueue;
use Illuminate\Mail\Message;
class SendInviteUserEmailHandler
{
/**
* The mailer instance.
*
* @var \Illuminate\Contracts\Mail\MailQueue
*/
protected $mailer;
/**
* Create a new send invite user email handler.
*
* @param \Illuminate\Contracts\Mail\Mailer $mailer
*
* @return void
*/
public function __construct(MailQueue $mailer)
{
$this->mailer = $mailer;
}
/**
* Handle the event.
*
* @param \CachetHQ\Cachet\Bus\Events\UserWasInvitedEvent $event
*
* @return void
*/
public function handle(UserWasInvitedEvent $event)
{
$mail = [
'email' => $event->invite->email,
'subject' => 'You have been invited.',
'link' => cachet_route('signup.invite', [$event->invite->code]),
];
$this->mailer->queue([
'html' => 'emails.users.invite-html',
'text' => 'emails.users.invite-text',
], $mail, function (Message $message) use ($mail) {
$message->to($mail['email'])->subject($mail['subject']);
});
}
}

View File

@@ -38,7 +38,7 @@ class ComposerServiceProvider extends ServiceProvider
{
$factory->composer('*', AppComposer::class);
$factory->composer('*', CurrentUserComposer::class);
$factory->composer(['index', 'single-incident', 'subscribe.*', 'signup', 'dashboard.settings.theme', 'emails.*'], ThemeComposer::class);
$factory->composer(['index', 'single-incident', 'subscribe.*', 'signup', 'dashboard.settings.theme', 'notifications::email'], ThemeComposer::class);
$factory->composer('dashboard.*', DashboardComposer::class);
$factory->composer(['setup.*', 'dashboard.settings.localization'], TimezoneLocaleComposer::class);

View File

@@ -52,7 +52,7 @@ class EventServiceProvider extends ServiceProvider
//
],
'CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasReportedEvent' => [
//
'CachetHQ\Cachet\Bus\Handlers\Events\IncidentUpdate\SendIncidentUpdateEmailNotificationHandler',
],
'CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasUpdatedEvent' => [
//
@@ -91,7 +91,7 @@ class EventServiceProvider extends ServiceProvider
//
],
'CachetHQ\Cachet\Bus\Events\Schedule\ScheduleWasCreatedEvent' => [
// 'CachetHQ\Cachet\Bus\Handlers\Events\Schedule\SendScheduleEmailNotificationHandler',
'CachetHQ\Cachet\Bus\Handlers\Events\Schedule\SendScheduleEmailNotificationHandler',
],
'CachetHQ\Cachet\Bus\Events\Schedule\ScheduleWasRemovedEvent' => [
//
@@ -100,7 +100,7 @@ class EventServiceProvider extends ServiceProvider
//
],
'CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasSubscribedEvent' => [
'CachetHQ\Cachet\Bus\Handlers\Events\Subscriber\SendSubscriberVerificationEmailHandler',
//
],
'CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasUnsubscribedEvent' => [
//
@@ -123,6 +123,9 @@ class EventServiceProvider extends ServiceProvider
'CachetHQ\Cachet\Bus\Events\System\SystemWasUpdatedEvent' => [
//
],
'CachetHQ\Cachet\Bus\Events\User\UserAcceptedInviteEvent' => [
//
],
'CachetHQ\Cachet\Bus\Events\User\UserDisabledTwoAuthEvent' => [
//
],
@@ -148,7 +151,7 @@ class EventServiceProvider extends ServiceProvider
//
],
'CachetHQ\Cachet\Bus\Events\User\UserWasInvitedEvent' => [
'CachetHQ\Cachet\Bus\Handlers\Events\User\SendInviteUserEmailHandler',
//
],
'CachetHQ\Cachet\Bus\Events\User\UserWasRemovedEvent' => [
//

View File

@@ -12,9 +12,9 @@
namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
use CachetHQ\Cachet\Bus\Commands\System\Config\UpdateConfigCommand;
use CachetHQ\Cachet\Bus\Commands\System\Mail\TestMailCommand;
use CachetHQ\Cachet\Integrations\Contracts\Credits;
use CachetHQ\Cachet\Models\User;
use CachetHQ\Cachet\Notifications\System\SystemTestNotification;
use CachetHQ\Cachet\Settings\Repository;
use Exception;
use GrahamCampbell\Binput\Facades\Binput;
@@ -294,7 +294,7 @@ class SettingsController extends Controller
*/
public function testMail()
{
dispatch(new TestMailCommand(Auth::user()));
Auth::user()->notify(new SystemTestNotification());
return cachet_redirect('dashboard.settings.mail')
->withSuccess(trans('dashboard.notifications.awesome'));

View File

@@ -45,7 +45,7 @@ class ApiRoutes
$router->get('incidents/templates', 'ApiController@getIncidentTemplate');
$router->post('components/groups/order', 'ApiController@postUpdateComponentGroupOrder');
$router->post('components/order', 'ApiController@postUpdateComponentOrder');
$router->post('components/{component}', 'ApiController@postUpdateComponent');
$router->any('components/{component}', 'ApiController@postUpdateComponent');
});
}
}

View File

@@ -12,9 +12,18 @@
namespace CachetHQ\Cachet\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
/**
* This is the invite class.
*
* @author Joseph Cohen <joe@alt-three.com>
* @author James Brooks <james@alt-three.com>
*/
class Invite extends Model
{
use Notifiable;
/**
* The attributes that should be casted to native types.
*
@@ -42,21 +51,11 @@ class Invite extends Model
self::creating(function ($invite) {
if (!$invite->code) {
$invite->code = self::generateInviteCode();
$invite->code = str_random(20);
}
});
}
/**
* Returns an invite code.
*
* @return string
*/
public static function generateInviteCode()
{
return str_random(20);
}
/**
* Determines if the invite was claimed.
*

View File

@@ -15,11 +15,19 @@ use AltThree\Validator\ValidatingTrait;
use CachetHQ\Cachet\Presenters\SubscriberPresenter;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use McCool\LaravelAutoPresenter\HasPresenter;
/**
* This is the subscriber model.
*
* @author Joseph Cohen <joe@alt-three.com>
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class Subscriber extends Model implements HasPresenter
{
use ValidatingTrait;
use Notifiable, ValidatingTrait;
/**
* The attributes that should be casted to native types.
@@ -27,10 +35,12 @@ class Subscriber extends Model implements HasPresenter
* @var string[]
*/
protected $casts = [
'email' => 'string',
'verify_code' => 'string',
'verified_at' => 'date',
'global' => 'bool',
'email' => 'string',
'phone_number' => 'string',
'slack_webhook_url' => 'string',
'verify_code' => 'string',
'verified_at' => 'date',
'global' => 'bool',
];
/**
@@ -40,6 +50,8 @@ class Subscriber extends Model implements HasPresenter
*/
protected $fillable = [
'email',
'phone_number',
'slack_webhook_url',
'verified_at',
'global',
];
@@ -50,7 +62,9 @@ class Subscriber extends Model implements HasPresenter
* @var string[]
*/
public $rules = [
'email' => 'required|email',
'email' => 'nullable|email',
'phone_number' => 'nullable|string',
'slack_webhook_url' => 'nullable|url',
];
/**
@@ -145,6 +159,26 @@ class Subscriber extends Model implements HasPresenter
return str_random(42);
}
/**
* Route notifications for the Nexmo channel.
*
* @return string
*/
public function routeNotificationForNexmo()
{
return $this->phone_number;
}
/**
* Route notifications for the Slack channel.
*
* @return string
*/
public function routeNotificationForSlack()
{
return $this->slack_webhook_url;
}
/**
* Get the presenter class.
*

View File

@@ -0,0 +1,151 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Notifications\Component;
use CachetHQ\Cachet\Models\Component;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\NexmoMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
/**
* This is the component status changed notification class.
*
* @author James Brooks <james@alt-three.com>
*/
class ComponentStatusChangedNotification extends Notification
{
use Queueable;
/**
* The component that changed.
*
* @var \CachetHQ\Cachet\Models\Component
*/
protected $component;
/**
* The component status we're now at.
*
* @var int
*/
protected $status;
/**
* Create a new notification instance.
*
* @param \CachetHQ\Cachet\Models\Component $component
* @param int $status
*
* @return void
*/
public function __construct(Component $component, $status)
{
$this->component = AutoPresenter::decorate($component);
$this->status = $status;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return string[]
*/
public function via($notifiable)
{
return ['mail', 'nexmo', 'slack'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$content = trans('notifications.component.status_update.content', [
'name' => $this->component->name,
'old_status' => $this->component->human_status,
'new_status' => trans("cachet.components.status.{$this->status}"),
]);
return (new MailMessage())
->subject(trans('notifications.component.status_update.subject'))
->greeting(trans('notifications.component.status_update.title'))
->line($content)
->action('View', cachet_route('status-page'))
->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
}
/**
* Get the Nexmo / SMS representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\NexmoMessage
*/
public function toNexmo($notifiable)
{
$content = trans('notifications.component.status_update.content', [
'name' => $this->component->name,
'old_status' => $this->component->human_status,
'new_status' => trans("cachet.components.status.{$this->status}"),
]);
return (new NexmoMessage())->content($content);
}
/**
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\SlackMessage
*/
public function toSlack($notifiable)
{
$content = trans('notifications.component.status_update.content', [
'name' => $this->component->name,
'old_status' => $this->component->human_status,
'new_status' => trans("cachet.components.status.{$this->status}"),
]);
$status = 'info';
if ($this->status <= 1) {
$status = 'success';
} elseif ($this->status === 2) {
$status = 'warning';
} elseif ($this->status >= 3) {
$status = 'error';
}
return (new SlackMessage())
->$status()
->content(trans('notifications.component.status_update.title'))
->attachment(function ($attachment) use ($content, $notifiable) {
$attachment->title($content, cachet_route('status-page'))
->fields(array_filter([
'Component' => $this->component->name,
'Old Status' => $this->component->human_status,
'New Status' => trans("cachet.components.status.{$this->status}"),
'Link' => $this->component->link,
]))
->footer(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
});
}
}

View File

@@ -0,0 +1,136 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Notifications\Incident;
use CachetHQ\Cachet\Models\Incident;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\NexmoMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Config;
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
/**
* This is the new incident notification class.
*
* @author James Brooks <james@alt-three.com>
*/
class NewIncidentNotification extends Notification
{
use Queueable;
/**
* The incident.
*
* @var \CachetHQ\Cachet\Models\Incident
*/
protected $incident;
/**
* Create a new notification instance.
*
* @param \CachetHQ\Cachet\Models\Incident $incident
*
* @return void
*/
public function __construct(Incident $incident)
{
$this->incident = AutoPresenter::decorate($incident);
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return string[]
*/
public function via($notifiable)
{
return ['mail', 'nexmo', 'slack'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$content = trans('notifications.incident.new.content', [
'name' => $this->incident->name,
]);
return (new MailMessage())
->subject(trans('notifications.incident.new.subject'))
->greeting(trans('notifications.incident.new.title', ['app_name' => Config::get('setting.app_name')]))
->line($content)
->action('View Incident', cachet_route('incident', [$this->incident]))
->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
}
/**
* Get the Nexmo / SMS representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\NexmoMessage
*/
public function toNexmo($notifiable)
{
$content = trans('notifications.incident.new.content', [
'name' => $this->incident->name,
]);
return (new NexmoMessage())->content($content);
}
/**
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\SlackMessage
*/
public function toSlack($notifiable)
{
$content = trans('notifications.incident.new.content', [
'name' => $this->incident->name,
]);
$status = 'info';
if ($this->incident->status === Incident::FIXED) {
$status = 'success';
} elseif ($this->incident->status === Incident::WATCHED) {
$status = 'warning';
} else {
$status = 'error';
}
return (new SlackMessage())
->$status()
->content(trans('notifications.incident.new.title', ['app_name' => Config::get('setting.app_name')]))
->attachment(function ($attachment) use ($content) {
$attachment->title($content)
->timestamp($this->incident->getWrappedObject()->occurred_at)
->fields(array_filter([
'ID' => "#{$this->incident->id}",
'Link' => $this->incident->permalink,
]))
->footer(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
});
}
}

View File

@@ -0,0 +1,143 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Notifications\IncidentUpdate;
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\IncidentUpdate;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\NexmoMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
/**
* This is the incident updated notification class.
*
* @author James Brooks <james@alt-three.com>
*/
class IncidentUpdatedNotification extends Notification
{
use Queueable;
/**
* The incident update.
*
* @var \CachetHQ\Cachet\Models\Incident
*/
protected $update;
/**
* Create a new notification instance.
*
* @param \CachetHQ\Cachet\Models\IncidentUpdate $update
*
* @return void
*/
public function __construct(IncidentUpdate $update)
{
$this->update = AutoPresenter::decorate($update);
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return string[]
*/
public function via($notifiable)
{
return ['mail', 'nexmo', 'slack'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$content = trans('notifications.incident.update.content', [
'name' => $this->update->name,
'time' => $this->update->created_at_diff,
]);
return (new MailMessage())
->subject(trans('notifications.incident.update.subject'))
->greeting(trans('notifications.incident.update.title', [
'name' => $this->update->incident->name,
'new_status' => $this->update->human_status,
]))
->line($content)
->action('View Incident', cachet_route('incident', [$this->update->incident]))
->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
}
/**
* Get the Nexmo / SMS representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\NexmoMessage
*/
public function toNexmo($notifiable)
{
$content = trans('notifications.incident.update.content', [
'name' => $this->update->incident->name,
]);
return (new NexmoMessage())->content($content);
}
/**
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\SlackMessage
*/
public function toSlack($notifiable)
{
$content = trans('notifications.incident.update.content', [
'name' => $this->update->incident->name,
]);
$status = 'info';
if ($this->update->status === Incident::FIXED) {
$status = 'success';
} elseif ($this->update->status === Incident::WATCHED) {
$status = 'warning';
} else {
$status = 'error';
}
return (new SlackMessage())
->$status()
->content(trans('notifications.incident.update.title', [
'name' => $this->update->incident->name,
'new_status' => $this->update->human_status,
]))
->attachment(function ($attachment) use ($content) {
$attachment->title($content)
->timestamp($this->update->getWrappedObject()->created_at)
->fields(array_filter([
'ID' => "#{$this->update->id}",
'Link' => $this->update->permalink,
]))
->footer(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
});
}
}

View File

@@ -0,0 +1,127 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Notifications\Schedule;
use CachetHQ\Cachet\Models\Schedule;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\NexmoMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
/**
* This is the new schedule notification class.
*
* @author James Brooks <james@alt-three.com>
*/
class NewScheduleNotification extends Notification
{
use Queueable;
/**
* The schedule.
*
* @var \CachetHQ\Cachet\Models\Schedule
*/
protected $schedule;
/**
* Create a new notification instance.
*
* @param \CachetHQ\Cachet\Models\Schedule $schedule
*
* @return void
*/
public function __construct(Schedule $schedule)
{
$this->schedule = AutoPresenter::decorate($schedule);
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return string[]
*/
public function via($notifiable)
{
return ['mail', 'nexmo', 'slack'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$content = trans('notifications.schedule.new.content', [
'name' => $this->schedule->name,
'date' => $this->schedule->scheduled_at_formatted,
]);
return (new MailMessage())
->subject(trans('notifications.schedule.new.subject'))
->greeting(trans('notifications.schedule.new.title'))
->line($content)
->action('View Schedule', cachet_route('schedule', [$this->schedule]))
->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
}
/**
* Get the Nexmo / SMS representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\NexmoMessage
*/
public function toNexmo($notifiable)
{
$content = trans('notifications.schedule.new.content', [
'name' => $this->schedule->name,
'date' => $this->schedule->scheduled_at_formatted,
]);
return (new NexmoMessage())->content($content);
}
/**
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\SlackMessage
*/
public function toSlack($notifiable)
{
$content = trans('notifications.schedule.new.content', [
'name' => $this->schedule->name,
'date' => $this->schedule->scheduled_at_formatted,
]);
return (new SlackMessage())
->content(trans('notifications.schedule.new.title'))
->attachment(function ($attachment) use ($content) {
$attachment->title($content)
->timestamp($this->schedule->getWrappedObject()->scheduled_at)
->fields(array_filter([
'ID' => "#{$this->schedule->id}",
'Status' => $this->schedule->human_status,
]))
->footer(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
});
}
}

View File

@@ -0,0 +1,55 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Notifications\Subscriber;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Config;
/**
* This is the verify subscription notification class.
*
* @author James Brooks <james@alt-three.com>
*/
class VerifySubscriptionNotification extends Notification
{
use Queueable;
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return string[]
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage())
->subject(trans('notifications.subscriber.verify.subject'))
->greeting(trans('notifications.subscriber.verify.title', ['app_name' => Config::get('setting.app_name')]))
->action(trans('notifications.subscriber.verify.action'), cachet_route('subscribe.verify', ['code' => $notifiable->verify_code]))
->line(trans('notifications.subscriber.verify.content', ['app_name' => Config::get('setting.app_name')]));
}
}

View File

@@ -0,0 +1,53 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Notifications\System;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
/**
* This is the system test notification class.
*
* @author James Brooks <james@alt-three.com>
*/
class SystemTestNotification extends Notification
{
use Queueable;
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return string[]
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage())
->subject(trans('notifications.system.test.subject'))
->greeting(trans('notifications.system.test.title'))
->line(trans('notifications.system.test.content'));
}
}

View File

@@ -0,0 +1,55 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Notifications\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Config;
/**
* This is the invite user notification class.
*
* @author James Brooks <james@alt-three.com>
*/
class InviteUserNotification extends Notification
{
use Queueable;
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return string[]
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage())
->subject(trans('notifications.user.invite.subject'))
->greeting(trans('notifications.user.invite.title', ['app_name' => Config::get('setting.app_name')]))
->action(trans('notifications.user.invite.action'), cachet_route('signup.invite', [$notifiable->code]))
->line(trans('notifications.user.invite.content', ['app_name' => Config::get('setting.app_name')]));
}
}

View File

@@ -36,7 +36,6 @@
"backup-manager/laravel": "^1.1",
"barryvdh/laravel-cors": "^0.8",
"doctrine/dbal": "^2.5",
"fedeisas/laravel-mail-css-inliner": "^1.5",
"fideloper/proxy": "^3.1",
"graham-campbell/binput": "^3.5",
"graham-campbell/core": "^5.1",
@@ -45,10 +44,11 @@
"guzzlehttp/guzzle": "^6.2.1",
"laravel/framework": "5.3.*",
"mccool/laravel-auto-presenter": "^4.3",
"nexmo/client": "@beta",
"pragmarx/google2fa": "^0.7.1",
"predis/predis": "^1.1",
"twig/twig": "^1.26.1",
"roumen/feed": "^2.10.4"
"roumen/feed": "^2.10.4",
"twig/twig": "^1.26.1"
},
"require-dev": {
"alt-three/testbench": "^1.9",

328
composer.lock generated
View File

@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "8a12e392376c66089b5435df09154936",
"content-hash": "4da236537bf5c691b4297b065c6669eb",
"hash": "63bbf3c3c93ca5e9a9b21a16156fdf4e",
"content-hash": "6f8ada6770ff17a57e4b6079e800443c",
"packages": [
{
"name": "alt-three/badger",
@@ -2089,6 +2089,64 @@
],
"time": "2016-12-15 18:03:17"
},
{
"name": "lcobucci/jwt",
"version": "3.2.1",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/jwt.git",
"reference": "ddce703826f9c5229781933b1a39069e38e6a0f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/jwt/zipball/ddce703826f9c5229781933b1a39069e38e6a0f3",
"reference": "ddce703826f9c5229781933b1a39069e38e6a0f3",
"shasum": ""
},
"require": {
"ext-openssl": "*",
"php": ">=5.5"
},
"require-dev": {
"mdanter/ecc": "~0.3.1",
"mikey179/vfsstream": "~1.5",
"phpmd/phpmd": "~2.2",
"phpunit/php-invoker": "~1.1",
"phpunit/phpunit": "~4.5",
"squizlabs/php_codesniffer": "~2.3"
},
"suggest": {
"mdanter/ecc": "Required to use Elliptic Curves based algorithms."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"autoload": {
"psr-4": {
"Lcobucci\\JWT\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Luís Otávio Cobucci Oblonczyk",
"email": "lcobucci@gmail.com",
"role": "Developer"
}
],
"description": "A simple library to work with JSON Web Token and JSON Web Signature",
"keywords": [
"JWS",
"jwt"
],
"time": "2016-10-31 20:09:32"
},
{
"name": "league/commonmark",
"version": "0.13.4",
@@ -2527,6 +2585,52 @@
],
"time": "2015-11-04 20:07:17"
},
{
"name": "nexmo/client",
"version": "1.0.0-beta3",
"source": {
"type": "git",
"url": "https://github.com/Nexmo/nexmo-php.git",
"reference": "83aa47336da9fa927ce62cb9fa3cbdaff1aeaaa0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Nexmo/nexmo-php/zipball/83aa47336da9fa927ce62cb9fa3cbdaff1aeaaa0",
"reference": "83aa47336da9fa927ce62cb9fa3cbdaff1aeaaa0",
"shasum": ""
},
"require": {
"lcobucci/jwt": "^3.2",
"php": ">=5.4",
"php-http/client-implementation": "^1.0",
"php-http/guzzle6-adapter": "^1.0",
"zendframework/zend-diactoros": "^1.3"
},
"require-dev": {
"php-http/mock-client": "^0.3.0",
"phpunit/phpunit": "^5.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Nexmo\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tim Lytle",
"email": "tim@nexmo.com",
"homepage": "http://twitter.com/tjlytle",
"role": "Developer"
}
],
"description": "PHP Client for using Nexmo's API.",
"time": "2016-09-14 03:43:04"
},
{
"name": "nikic/php-parser",
"version": "v3.0.2",
@@ -2626,6 +2730,172 @@
],
"time": "2016-11-07 23:38:38"
},
{
"name": "php-http/guzzle6-adapter",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/php-http/guzzle6-adapter.git",
"reference": "a56941f9dc6110409cfcddc91546ee97039277ab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/guzzle6-adapter/zipball/a56941f9dc6110409cfcddc91546ee97039277ab",
"reference": "a56941f9dc6110409cfcddc91546ee97039277ab",
"shasum": ""
},
"require": {
"guzzlehttp/guzzle": "^6.0",
"php": ">=5.5.0",
"php-http/httplug": "^1.0"
},
"provide": {
"php-http/async-client-implementation": "1.0",
"php-http/client-implementation": "1.0"
},
"require-dev": {
"ext-curl": "*",
"php-http/adapter-integration-tests": "^0.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
}
},
"autoload": {
"psr-4": {
"Http\\Adapter\\Guzzle6\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
},
{
"name": "David de Boer",
"email": "david@ddeboer.nl"
}
],
"description": "Guzzle 6 HTTP Adapter",
"homepage": "http://httplug.io",
"keywords": [
"Guzzle",
"http"
],
"time": "2016-05-10 06:13:32"
},
{
"name": "php-http/httplug",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/httplug.git",
"reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/httplug/zipball/1c6381726c18579c4ca2ef1ec1498fdae8bdf018",
"reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018",
"shasum": ""
},
"require": {
"php": ">=5.4",
"php-http/promise": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"henrikbjorn/phpspec-code-coverage": "^1.0",
"phpspec/phpspec": "^2.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"psr-4": {
"Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eric GELOEN",
"email": "geloen.eric@gmail.com"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "HTTPlug, the HTTP client abstraction for PHP",
"homepage": "http://httplug.io",
"keywords": [
"client",
"http"
],
"time": "2016-08-31 08:30:17"
},
{
"name": "php-http/promise",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/promise.git",
"reference": "dc494cdc9d7160b9a09bd5573272195242ce7980"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/promise/zipball/dc494cdc9d7160b9a09bd5573272195242ce7980",
"reference": "dc494cdc9d7160b9a09bd5573272195242ce7980",
"shasum": ""
},
"require-dev": {
"henrikbjorn/phpspec-code-coverage": "^1.0",
"phpspec/phpspec": "^2.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"psr-4": {
"Http\\Promise\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
},
{
"name": "Joel Wurtz",
"email": "joel.wurtz@gmail.com"
}
],
"description": "Promise used for asynchronous HTTP requests",
"homepage": "http://httplug.io",
"keywords": [
"promise"
],
"time": "2016-01-26 13:27:02"
},
{
"name": "pragmarx/google2fa",
"version": "v0.7.1",
@@ -4128,6 +4398,56 @@
"environment"
],
"time": "2016-09-01 10:05:43"
},
{
"name": "zendframework/zend-diactoros",
"version": "1.3.7",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-diactoros.git",
"reference": "969ff423d3f201da3ff718a5831bb999bb0669b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/969ff423d3f201da3ff718a5831bb999bb0669b0",
"reference": "969ff423d3f201da3ff718a5831bb999bb0669b0",
"shasum": ""
},
"require": {
"php": "^5.4 || ^7.0",
"psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "~1.0.0"
},
"require-dev": {
"phpunit/phpunit": "^4.6 || ^5.5",
"squizlabs/php_codesniffer": "^2.3.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev",
"dev-develop": "1.4-dev"
}
},
"autoload": {
"psr-4": {
"Zend\\Diactoros\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"description": "PSR HTTP Message implementations",
"homepage": "https://github.com/zendframework/zend-diactoros",
"keywords": [
"http",
"psr",
"psr-7"
],
"time": "2016-10-11 13:25:21"
}
],
"packages-dev": [
@@ -5881,7 +6201,9 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {
"nexmo/client": 10
},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {

View File

@@ -177,7 +177,6 @@ return [
AltThree\Emoji\EmojiServiceProvider::class,
BackupManager\Laravel\Laravel5ServiceProvider::class,
Barryvdh\Cors\ServiceProvider::class,
Fedeisas\LaravelMailCssInliner\LaravelMailCssInlinerServiceProvider::class,
Fideloper\Proxy\TrustedProxyServiceProvider::class,
GrahamCampbell\Binput\BinputServiceProvider::class,
GrahamCampbell\Exceptions\ExceptionsServiceProvider::class,

View File

@@ -1,41 +0,0 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
/*
|--------------------------------------------------------------------------
| Strip styles
|--------------------------------------------------------------------------
|
| Settings this to false prevents the inliner from removing the style
| definitions that have been inlined.
|
| Notice that media query styles are not inlined, and hence never
| stripped.
|
*/
'strip-styles' => true,
/*
|--------------------------------------------------------------------------
| Remove classes
|--------------------------------------------------------------------------
|
| Settings this to false disables the removal of class attributes from
| your html elements (do not enable this if you use media queries)
|
*/
'strip-classes' => true,
];

View File

@@ -36,6 +36,12 @@ return [
'secret' => env('MAIL_PASSWORD'),
],
'nexmo' => [
'key' => env('NEXMO_KEY'),
'secret' => env('NEXMO_SECRET'),
'sms_from' => env('NEXMO_SMS_FROM'),
],
'ses' => [
'key' => env('MAIL_USERNAME'),
'secret' => env('MAIL_PASSWORD'),

View File

@@ -0,0 +1,43 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterTableSubscribersAddPhoneNumberSlackColumns extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('subscribers', function (Blueprint $table) {
$table->string('email')->nullable()->default(null)->change();
$table->string('phone_number')->nullable()->default(null)->after('verify_code');
$table->string('slack_webhook_url')->nullable()->default(null)->after('phone_number');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('subscribers', function (Blueprint $table) {
$table->dropColumn(['phone_number', 'slack_webhook_url']);
});
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterTableComponentsMakeLinkNullable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('components', function (Blueprint $table) {
$table->text('link')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@@ -0,0 +1,44 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('type');
$table->morphs('notifiable');
$table->text('data');
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
}

View File

@@ -76,9 +76,10 @@ return [
// Subscriber
'subscriber' => [
'subscribe' => 'Subscribe to get the updates',
'button' => 'Subscribe',
'manage' => [
'subscribe' => 'Subscribe to get the updates',
'unsubscribe' => 'Unsubscribe at :link',
'button' => 'Subscribe',
'manage' => [
'no_subscriptions' => 'You\'re currently subscribed to all updates.',
'my_subscriptions' => 'You\'re currently subscribed to the following updates.',
],
@@ -91,32 +92,6 @@ return [
'unsubscribed' => 'Your email subscription has been cancelled.',
'failure' => 'Something went wrong with the subscription.',
'already-subscribed' => 'Cannot subscribe :email because they\'re already subscribed.',
'verify' => [
'text' => "Please confirm your email subscription to :app_name status updates.\n:link",
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p>',
'button' => 'Confirm Subscription',
],
'maintenance' => [
'subject' => '[Maintenance Scheduled] :name',
],
'incident' => [
'subject' => '[New Incident] :status: :name',
],
'component' => [
'subject' => 'Component Status Update',
'text' => 'The component :component_name has seen a status change. The component is now at :component_human_status.\nThank you, :app_name',
'html' => '<p>The component :component_name has seen a status change. The component is now at :component_human_status.</p><p>Thank you, :app_name</p>',
'tooltip-title' => 'Subscribe to notifications for :component_name.',
],
],
],
'users' => [
'email' => [
'invite' => [
'text' => "You have been invited to the team :app_name status page, to sign up follow the next link.\n:link\nThank you, :app_name",
'html' => '<p>You have been invited to the team :app_name status page, to sign up follow the next link.</p><p><a href=":link">:link</a></p><p>Thank you, :app_name</p>',
],
],
],

View File

@@ -0,0 +1,65 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
'component' => [
'status_update' => [
'subject' => 'Component Status Updated',
'title' => 'A component\'s status was updated!',
'content' => ':name status changed from :old_status to :new_status.',
],
],
'incident' => [
'new' => [
'subject' => 'New Incident Reported',
'content' => ':name was reported',
'title' => 'A new incident was reported at :app_name status page.',
'action' => 'View',
],
'update' => [
'subject' => 'Incident Updated',
'content' => ':name was updated',
'title' => ':name was updated to :new_status',
'action' => 'View',
],
],
'schedule' => [
'new' => [
'subject' => 'New Schedule Created',
'content' => ':name was scheduled for :date',
'title' => 'A new scheduled maintenance was created.',
'action' => 'View',
],
],
'subscriber' => [
'verify' => [
'subject' => 'Verify Your Subscription',
'content' => 'Click to verify your subscription to :app_name status page.',
'title' => 'Verify your subscription to :app_name status page.',
'action' => 'Verify',
],
],
'system' => [
'test' => [
'subject' => 'Ping from Cachet!',
'content' => 'This is a test notification from Cachet!',
'title' => '🔔',
],
],
'user' => [
'invite' => [
'subject' => 'Your invitation is inside...',
'content' => 'You have been invited to join :app_name status page.',
'title' => 'You\'re invited to join :app_name status page.',
'action' => 'Accept',
],
],
];

View File

@@ -115,14 +115,12 @@
<input type="text" name="occurred_at" class="form-control" rel="datepicker-custom" data-date-format="YYYY-MM-DD HH:mm" placeholder="{{ trans('forms.optional') }}">
</div>
<input type="hidden" name="notify" value="0">
@if($enable_subscribers)
<div class="checkbox">
<label>
<input type="checkbox" name="notify" value="1" checked="{{ Binput::old('notify', 'checked') }}">
{{ trans('forms.incidents.notify_subscribers') }}
</label>
</div>
@endif
</fieldset>
<div class="form-group">

View File

@@ -1,20 +0,0 @@
@extends('layout.emails')
@section('content')
{!! trans('cachet.subscriber.email.component.html', ['component_name' => $component_name, 'component_human_status' => $component_human_status, 'app_name' => $app_name]) !!}
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<div>
<!--[if mso]><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="{{ $manage_link }}" style="height:45px;v-text-anchor:middle;width:200px;" arcsize="7%" stroke="f" fill="t">
<v:fill type="tile" color="#22BC66" />
<w:anchorlock/>
<center style="color:#ffffff;font-family:sans-serif;font-size:15px;">{!! trans('cachet.subscriber.email.manage') !!}</center>
</v:roundrect><![endif]-->
<a href="{{ $manage_link }}" class="button button--green">{!! trans('cachet.subscriber.email.manage') !!}</a>
</div>
</td>
</tr>
</table>
@stop

View File

@@ -1,7 +0,0 @@
{!! trans('cachet.subscriber.email.component.text', ['component_name' => $component_name, 'component_human_status' => $component_human_status, 'app_name' => $app_name]) !!}
{!! trans('cachet.subscriber.email.manage') !!} {{ $manage_link }}
@if($show_support)
{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
@endif

View File

@@ -1,40 +0,0 @@
@extends('layout.emails')
@section('content')
<h1 class="align-center">{!! $name !!}</h1>
<table class="border-rounded" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<p class="compressed">
<strong>{!! $status !!}</strong>
{!! $html_content !!}
{!! $timestamp !!}
</p>
</td>
<tr>
</table>
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<div>
<!--[if mso]><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="{{ $manage_link }}" style="height:45px;v-text-anchor:middle;width:200px;" arcsize="7%" stroke="f" fill="t">
<v:fill type="tile" color="#22BC66" />
<w:anchorlock/>
<center style="color:#ffffff;font-family:sans-serif;font-size:15px;">{!! trans('cachet.subscriber.email.manage') !!}</center>
</v:roundrect><![endif]-->
<a href="{{ $manage_link }}" class="button button--green">{!! trans('cachet.subscriber.email.manage') !!}</a>
</div>
</td>
</tr>
</table>
<table class="body-sub" align="center">
<tr>
<td align="center">
<p class="sub"><a href="{{ $unsubscribe_link }}">{!! trans('cachet.subscriber.email.unsubscribe') !!}</a></p>
</td>
</tr>
</table>
@stop

View File

@@ -1,13 +0,0 @@
{!! $name !!}
{!! $status !!}
{!! $text_content !!}
{!! $timestamp !!}
{!! trans('cachet.subscriber.email.manage') !!} {{ $manage_link }}
{!! trans('cachet.subscriber.email.unsubscribe') !!} {{ $unsubscribe_link }}
@if($show_support)
{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
@endif

View File

@@ -1,40 +0,0 @@
@extends('layout.emails')
@section('content')
<h1 class="align-center">{!! $name !!}</h1>
<table class="border-rounded" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<p class="compressed">
<strong>{!! $status !!} @if($has_component) ({{ $component_name }}) @endif</strong>
{!! $html_content !!}
{!! $timestamp !!}
</p>
</td>
<tr>
</table>
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<div>
<!--[if mso]><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="{{ $manage_link }}" style="height:45px;v-text-anchor:middle;width:200px;" arcsize="7%" stroke="f" fill="t">
<v:fill type="tile" color="#22BC66" />
<w:anchorlock/>
<center style="color:#ffffff;font-family:sans-serif;font-size:15px;">{!! trans('cachet.subscriber.email.manage') !!}</center>
</v:roundrect><![endif]-->
<a href="{{ $manage_link }}" class="button button--green">{!! trans('cachet.subscriber.email.manage') !!}</a>
</div>
</td>
</tr>
</table>
<table class="body-sub" align="center">
<tr>
<td align="center">
<p class="sub"><a href="{{ $unsubscribe_link }}">{!! trans('cachet.subscriber.email.unsubscribe') !!}</a></p>
</td>
</tr>
</table>
@stop

View File

@@ -1,17 +0,0 @@
{!! $name !!}
{!! $status !!}
{!! $text_content !!}
{!! $timestamp !!}
@if($has_component)
({{ $component_name }})
@endif
{!! trans('cachet.subscriber.email.manage') !!} {{ $manage_link }}
{!! trans('cachet.subscriber.email.unsuscribe') !!} {{ $unsubscribe_link }}
@if($show_support)
{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
@endif

View File

@@ -1,20 +0,0 @@
@extends('layout.emails')
@section('content')
{!! trans('cachet.subscriber.email.verify.html', ['app_name' => $app_name]) !!}
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<div>
<!--[if mso]><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="{{ $link }}" style="height:45px;v-text-anchor:middle;width:200px;" arcsize="7%" stroke="f" fill="t">
<v:fill type="tile" color="#22BC66" />
<w:anchorlock/>
<center style="color:#ffffff;font-family:sans-serif;font-size:15px;">{{ trans('cachet.subscriber.email.verify.button') }}</center>
</v:roundrect><![endif]-->
<a href="{{ $link }}" class="button button--green">{{ trans('cachet.subscriber.email.verify.button') }}</a>
</div>
</td>
</tr>
</table>
@stop

View File

@@ -1,5 +0,0 @@
{{ trans('cachet.subscriber.email.verify.text', ['app_name' => $app_name, 'link' => $link]) }}
@if($show_support)
{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
@endif

View File

@@ -1,5 +0,0 @@
@extends('layout.emails')
@section('content')
{{ trans('dashboard.settings.mail.email.body') }}
@stop

View File

@@ -1,5 +0,0 @@
{{ trans('dashboard.settings.mail.email.body') }}
@if($show_support)
{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
@endif

View File

@@ -1,5 +0,0 @@
@extends('layout.emails')
@section('content')
{!! trans('cachet.users.email.invite.html', ['app_name' => $app_name, 'link' => $link]) !!}
@stop

View File

@@ -1,5 +0,0 @@
{{ trans('cachet.users.email.invite.text', ['app_name' => $app_name, 'link' => $link]) }}
@if($show_support)
{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
@endif

View File

@@ -1,238 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="format-detection" content="address=no;=no;telephone=no" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>{{ $app_name }}</title>
<style type="text/css" rel="stylesheet" media="all">
/* Base ------------------------------ */
*:not(br):not(tr):not(html) {
font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
width: 100% !important;
height: 100%;
margin: 0;
line-height: 1.4;
background-color: #F2F4F6;
color: #74787E;
-webkit-text-size-adjust: none;
}
a {
color: {{ $theme_links }};
}
a img {
color: none;
border: none;
}
/* Layout ------------------------------ */
.email-wrapper {
width: 100%;
margin: 0;
padding: 0;
background-color: #F2F4F6;
}
.email-content {
width: 100%;
margin: 0;
padding: 0;
}
/* Masthead ----------------------- */
.email-masthead {
padding: 25px 0;
text-align: center;
}
.email-masthead_logo {
max-width: 400px;
border: 0;
}
.email-masthead_name {
font-size: 40px;
font-weight: bold;
color: #bbbfc3;
text-decoration: none;
text-shadow: 0 1px 0 white;
}
/* Body ------------------------------ */
.email-body {
width: 100%;
margin: 0;
padding: 0;
border-top: 1px solid #EDEFF2;
border-bottom: 1px solid #EDEFF2;
background-color: #FFF;
}
.email-body_inner {
width: 570px;
margin: 0 auto;
padding: 0;
}
.email-footer {
width: 570px;
margin: 0 auto;
padding: 0;
text-align: center;
}
.email-footer p {
color: #AEAEAE;
}
.email-footer img {
width: 30px;
}
.body-action {
width: 100%;
margin: 30px auto;
padding: 0;
text-align: center;
}
.body-sub {
margin-top: 25px;
padding-top: 25px;
border-top: 1px solid #EDEFF2;
}
.content-cell {
padding: 35px;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
.border-rounded {
border: 1px solid #EDEFF2;
border-radius: 3px;
padding: 12px;
}
/* Type ------------------------------ */
h1 {
margin-top: 0;
color: #2F3133;
font-size: 36px;
font-weight: bold;
text-align: left;
}
h2 {
margin-top: 0;
color: #2F3133;
font-size: 16px;
font-weight: bold;
text-align: left;
}
h3 {
margin-top: 0;
color: #2F3133;
font-size: 14px;
font-weight: bold;
text-align: left;
}
p {
margin-top: 0;
color: #74787E;
font-size: 16px;
line-height: 1.5em;
text-align: left;
}
p.compressed {
margin: 0;
}
p.sub {
font-size: 12px;
}
p.center {
text-align: center;
}
/* Buttons ------------------------------ */
.button {
display: inline-block;
width: 200px;
background-color: #3869D4;
border-radius: 3px;
color: #ffffff;
font-size: 15px;
line-height: 45px;
text-align: center;
text-decoration: none;
-webkit-text-size-adjust: none;
mso-hide: all;
}
.button--green {
background-color: {{ $theme_greens }};
}
.button--red {
background-color: {{ $theme_reds }};
}
.button--blue {
background-color: {{ $theme_blues }};
}
.button--yellow {
background-color: {{ $theme_yellows }};
}
/*Media Queries ------------------------------ */
@media only screen and (max-width: 600px) {
.email-body_inner,
.email-footer {
width: 100% !important;
}
}
@media only screen and (max-width: 500px) {
.button {
width: 100% !important;
}
}
</style>
</head>
<body>
<table class="email-wrapper" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table class="email-content" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="email-masthead">
<a class="email-masthead_name">{{ $app_name}} </a>
</td>
</tr>
<tr>
<td class="email-body" width="100%">
<table class="email-body_inner" align="center" width="570" cellpadding="0" cellspacing="0">
<!-- Body content -->
<tr>
<td class="content-cell">
@yield('content')
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table class="email-footer" align="center" width="570" cellpadding="0" cellspacing="0">
<tr>
<td class="content-cell">
@if($show_support)
<p class="sub center">{!! trans('cachet.powered_by') !!}</p>
@endif
<p class="sub center">
<a href="https://cachethq.io"><img src="{{ asset('img/button-email--dark-grey.png') }}" alt="Cachet"></a>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -1,143 +0,0 @@
<style type="text/css">
body {
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
body,
p,
img,
table,
td,
#body {
margin-top: 0;
margin-left: 0;
margin-right: 0;
margin-bottom: 0;
padding-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
}
img {
height: auto;
width: auto;
line-height: 100%;
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}
table {
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
table,
td {
border-collapse: collapse;
border-spacing: 0;
}
td,
p {
-webkit-text-size-adjust: none;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
}
p {
margin-bottom: 24px;
}
a {
color: #6DB81C;
}
body,
#body,
.body-cell {
height: 100%;
width: 100%;
}
.body-cell {
padding-top: 32px;
padding-bottom: 32px;
padding-left: 16px;
padding-right: 16px;
}
.box {
width: 544px;
margin-left: auto;
margin-right: auto;
}
.header,
.body {
width: 512px;
}
.body {
padding-top: 16px;
padding-bottom: 0;
padding-left: 16px;
padding-right: 16px;
}
.header {
padding: 16px;
}
.header-logo {
text-align: left;
vertical-align: top;
}
.footer {
text-align: center;
font-size: 12px;
line-height: 21px;
padding-top: 14px;
width: 544px;
}
.body p {
font-size: 14px;
line-height: 22px;
text-align: left;
}
.body {
color: #727272;
}
.footer {
color: #727272;
}
.header {
background-color: #ffffff;
}
.body {
background-color: #ffffff;
}
body,
#body,
.body-cell {
background-color: #ebebeb;
}
@media only screen and (max-width: 600px) {
td[class=body-cell] {
padding-left: 0 !important;
padding-right: 0 !important;
}
}
@media only screen and (max-width: 560px) {
td[class=body-cell] {
padding: 8px !important;
}
table[id=body],
td[class=body-cell],
table[class=box],
td[class~=body] {
display: block !important;
width: auto !important;
}
td[class~=body] {
overflow: hidden !important;
}
td[class~=body] p {
font-size: 16px !important;
line-height: 24px !important;
}
td[class~=body] p {
margin-bottom: 18px;
}
td[class~=body] {
padding-top: 16px !important;
}
}
</style>

View File

@@ -11,6 +11,8 @@
namespace CachetHQ\Tests\Cachet\Api;
use Illuminate\Support\Facades\Notification;
/**
* This is the subscriber test class.
*
@@ -41,6 +43,8 @@ class SubscriberTest extends AbstractApiTestCase
{
$this->beUser();
Notification::fake();
$this->expectsEvents('CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasSubscribedEvent');
$this->post('/api/v1/subscribers', [
@@ -55,6 +59,10 @@ class SubscriberTest extends AbstractApiTestCase
{
$this->beUser();
Notification::fake();
$this->expectsEvents('CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasSubscribedEvent');
$this->post('/api/v1/subscribers', [
'email' => 'support@alt-three.com',
'verify' => true,

View File

@@ -1,46 +0,0 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Tests\Cachet\Bus\Commands\System\Mail;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\System\Mail\TestMailCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\System\Mail\TestMailCommandHandler;
use CachetHQ\Cachet\Models\User;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the test mail command test class.
*
* @author James Brooks <james@alt-three.com>
*/
class TestMailCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = ['user' => new User()];
$object = new TestMailCommand($params['user']);
return compact('params', 'object');
}
protected function objectHasRules()
{
return false;
}
protected function getHandlerClass()
{
return TestMailCommandHandler::class;
}
}

View File

@@ -40,7 +40,7 @@ class ComponentStatusWasUpdatedEventTest extends AbstractComponentEventTestCase
$this->app['events']->fire(new ComponentStatusWasUpdatedEvent($component, 1, 2));
$this->seeMessageFor($subscriber->email);
$this->seeMessageWithSubject(trans('cachet.subscriber.email.component.subject'));
$this->seeMessageWithSubject(trans('notifications.component.status_update.subject'));
$message = $this->getMailer()->lastMessage();

View File

@@ -28,8 +28,11 @@ class IncidentWasReportedEventTest extends AbstractIncidentEventTestCase
protected function getObjectAndParams()
{
$params = ['incident' => new Incident()];
$object = new IncidentWasReportedEvent($params['incident']);
$params = [
'incident' => new Incident(),
'notify' => true,
];
$object = new IncidentWasReportedEvent($params['incident'], $params['notify']);
return compact('params', 'object');
}

View File

@@ -18,7 +18,7 @@ class IncidentUpdateWasReportedEventTest extends AbstractIncidentUpdateEventTest
{
protected function objectHasHandlers()
{
return false;
return true;
}
protected function getObjectAndParams()

View File

@@ -18,7 +18,7 @@ class ScheduleWasCreatedEventTest extends AbstractScheduleEventTestCase
{
protected function objectHasHandlers()
{
return false;
return true;
}
protected function getObjectAndParams()

View File

@@ -18,7 +18,7 @@ class SubscriberHasSubscribedEventTest extends AbstractSubscriberEventTestCase
{
protected function objectHasHandlers()
{
return true;
return false;
}
protected function getObjectAndParams()

View File

@@ -0,0 +1,40 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Tests\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\User\UserAcceptedInviteEvent;
use CachetHQ\Cachet\Models\Invite;
use CachetHQ\Cachet\Models\User;
/**
* This is the user accepted invite event test class.
*
* @author James Brooks <james@alt-three.com>
*/
class UserAcceptedInviteEventTest extends AbstractUserEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = [
'user' => new User(),
'invite' => new Invite(),
];
$object = new UserAcceptedInviteEvent($params['user'], $params['invite']);
return compact('params', 'object');
}
}

View File

@@ -23,7 +23,7 @@ class UserWasInvitedEventTest extends AbstractUserEventTestCase
{
protected function objectHasHandlers()
{
return true;
return false;
}
protected function getObjectAndParams()