Rename incident events and fixes

This commit is contained in:
Joseph Cohen
2015-08-15 22:15:06 -05:00
committed by James Brooks
parent a93472f544
commit 64ff4d73c2
13 changed files with 116 additions and 20 deletions

View File

@@ -11,7 +11,7 @@
namespace CachetHQ\Cachet\Http\Controllers\Api;
use CachetHQ\Cachet\Events\Incident\IncidentHasReportedEvent;
use CachetHQ\Cachet\Events\Incident\IncidentWasReportedEvent;
use CachetHQ\Cachet\Models\Incident;
use Exception;
use GrahamCampbell\Binput\Facades\Binput;
@@ -80,7 +80,7 @@ class IncidentController extends AbstractApiController
}
if (array_get($incidentData, 'notify') && subscribers_enabled()) {
event(new IncidentHasReportedEvent($incident));
event(new IncidentWasReportedEvent($incident));
}
return $this->item($incident);

View File

@@ -46,7 +46,7 @@ class SubscriberController extends AbstractApiController
public function postSubscribers()
{
try {
$subscriber = $this->dispatch(new SubscribeSubscriberCommand(Binput::get('email'), Binput::get('verified', false)));
$subscriber = $this->dispatch(new SubscribeSubscriberCommand(Binput::get('email'), Binput::get('verify', false)));
} catch (Exception $e) {
throw new BadRequestHttpException();
}

View File

@@ -12,7 +12,7 @@
namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
use AltThree\Validator\ValidationException;
use CachetHQ\Cachet\Events\Incident\IncidentHasReportedEvent;
use CachetHQ\Cachet\Events\Incident\IncidentWasReportedEvent;
use CachetHQ\Cachet\Facades\Setting;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\ComponentGroup;
@@ -133,7 +133,7 @@ class IncidentController extends Controller
}
if (array_get($incidentData, 'notify') && subscribers_enabled()) {
event(new IncidentHasReportedEvent($incident));
event(new IncidentWasReportedEvent($incident));
}
return Redirect::route('dashboard.incidents.add')

View File

@@ -12,7 +12,7 @@
namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
use AltThree\Validator\ValidationException;
use CachetHQ\Cachet\Events\MaintenanceHasScheduledEvent;
use CachetHQ\Cachet\Events\MaintenanceWasScheduledEvent;
use CachetHQ\Cachet\Facades\Setting;
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\IncidentTemplate;
@@ -118,7 +118,7 @@ class ScheduleController extends Controller
}
if (array_get($scheduleData, 'notify') && subscribers_enabled()) {
event(new MaintenanceHasScheduledEvent($incident));
event(new MaintenanceWasScheduledEvent($incident));
}
return Redirect::route('dashboard.schedule.add')

View File

@@ -57,10 +57,8 @@ class SubscriberController extends Controller
*/
public function createSubscriberAction()
{
$email = Binput::get('email');
try {
$this->dispatch(new SubscribeSubscriberCommand($email));
$this->dispatch(new SubscribeSubscriberCommand(Binput::get('email')));
} catch (ValidationException $e) {
return Redirect::route('dashboard.subscribers.add')
->withInput(Binput::all())
@@ -68,8 +66,6 @@ class SubscriberController extends Controller
->withErrors($e->getMessageBag());
}
event(new CustomerHasSubscribedEvent($subscriber));
return Redirect::route('dashboard.subscribers.add')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.subscribers.add.success')));
}