Updated autopresenter

This commit is contained in:
Graham Campbell 2015-10-07 14:42:39 +01:00
parent b6fbe53b28
commit 995fdd4049
4 changed files with 13 additions and 31 deletions

View File

@ -15,7 +15,7 @@ use CachetHQ\Cachet\Events\Incident\IncidentWasReportedEvent;
use CachetHQ\Cachet\Models\Subscriber;
use Illuminate\Contracts\Mail\MailQueue;
use Illuminate\Mail\Message;
use McCool\LaravelAutoPresenter\PresenterDecorator;
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
class SendIncidentEmailNotificationHandler
{
@ -33,27 +33,18 @@ class SendIncidentEmailNotificationHandler
*/
protected $subscriber;
/**
* The presenter instance.
*
* @var \McCool\LaravelAutoPresenter\PresenterDecorator
*/
protected $presenter;
/**
* Create a new send incident email notification handler.
*
* @param \Illuminate\Contracts\Mail\Mailer $mailer
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
* @param \McCool\LaravelAutoPresenter\PresenterDecorator $presenter
* @param \Illuminate\Contracts\Mail\Mailer $mailer
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return void
*/
public function __construct(MailQueue $mailer, Subscriber $subscriber, PresenterDecorator $presenter)
public function __construct(MailQueue $mailer, Subscriber $subscriber)
{
$this->mailer = $mailer;
$this->subscriber = $subscriber;
$this->presenter = $presenter;
}
/**
@ -65,8 +56,8 @@ class SendIncidentEmailNotificationHandler
*/
public function handle(IncidentWasReportedEvent $event)
{
$incident = $this->presenter->decorate($event->incident);
$component = $this->presenter->decorate($event->incident->component);
$incident = AutoPresenter::decorate($event->incident);
$component = AutoPresenter::decorate($event->incident->component);
// Only send emails for public incidents.
if ($event->incident->visible === 1) {

View File

@ -15,7 +15,7 @@ use CachetHQ\Cachet\Events\Incident\MaintenanceWasScheduledEvent;
use CachetHQ\Cachet\Models\Subscriber;
use Illuminate\Contracts\Mail\MailQueue;
use Illuminate\Mail\Message;
use McCool\LaravelAutoPresenter\PresenterDecorator;
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
class SendMaintenanceEmailNotificationHandler
{
@ -33,27 +33,18 @@ class SendMaintenanceEmailNotificationHandler
*/
protected $subscriber;
/**
* The presenter instance.
*
* @var \McCool\LaravelAutoPresenter\PresenterDecorator
*/
protected $presenter;
/**
* Create a new send maintenance email notification handler.
*
* @param \Illuminate\Contracts\Mail\Mailer $mailer
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
* @param \McCool\LaravelAutoPresenter\PresenterDecorator $presenter
* @param \Illuminate\Contracts\Mail\Mailer $mailer
* @param \CachetHQ\Cachet\Models\Subscriber $subscriber
*
* @return void
*/
public function __construct(MailQueue $mailer, Subscriber $subscriber, PresenterDecorator $presenter)
public function __construct(MailQueue $mailer, Subscriber $subscriber)
{
$this->mailer = $mailer;
$this->subscriber = $subscriber;
$this->presenter = $presenter;
}
/**
@ -65,7 +56,7 @@ class SendMaintenanceEmailNotificationHandler
*/
public function handle(MaintenanceWasScheduledEvent $event)
{
$data = $this->presenter->decorate($event->incident);
$data = AutoPresenter::decorate($event->incident);
foreach ($this->subscriber->all() as $subscriber) {
$mail = [

View File

@ -33,7 +33,7 @@
"graham-campbell/exceptions": "^5.0",
"guzzlehttp/guzzle": "^6.1",
"jenssegers/date": "^3.0",
"mccool/laravel-auto-presenter": "^3.1",
"mccool/laravel-auto-presenter": "^4.1",
"pragmarx/google2fa": "^0.5",
"roumen/feed": "^2.9"
},

View File

@ -159,7 +159,7 @@ return [
'GrahamCampbell\Security\SecurityServiceProvider',
'GrahamCampbell\Throttle\ThrottleServiceProvider',
'Jenssegers\Date\DateServiceProvider',
'McCool\LaravelAutoPresenter\LaravelAutoPresenterServiceProvider',
'McCool\LaravelAutoPresenter\AutoPresenterServiceProvider',
'PragmaRX\Google2FA\Vendor\Laravel\ServiceProvider',
'Roumen\Feed\FeedServiceProvider',