Only send component change email when the status changes. Fixes #1989
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Component;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand;
|
||||
use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasUpdatedEvent;
|
||||
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasUpdatedEvent;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
|
||||
@@ -28,6 +29,10 @@ class UpdateComponentCommandHandler
|
||||
{
|
||||
$component = $command->component;
|
||||
|
||||
if ($command->status && $component->status !== $command->status) {
|
||||
event(new ComponentStatusWasUpdatedEvent($component, $component->status, $command->status));
|
||||
}
|
||||
|
||||
$component->update($this->filter($command));
|
||||
|
||||
event(new ComponentWasUpdatedEvent($component));
|
||||
|
||||
Reference in New Issue
Block a user