Don't fire component update emails if the status hasn't changed.
Fixes #2113
This commit is contained in:
@@ -28,10 +28,9 @@ class UpdateComponentCommandHandler
|
||||
public function handle(UpdateComponentCommand $command)
|
||||
{
|
||||
$component = $command->component;
|
||||
$originalStatus = $component->status;
|
||||
|
||||
if ($command->status && $component->status !== $command->status) {
|
||||
event(new ComponentStatusWasUpdatedEvent($component, $component->status, $command->status));
|
||||
}
|
||||
event(new ComponentStatusWasUpdatedEvent($component, $originalStatus, $command->status));
|
||||
|
||||
$component->update($this->filter($command));
|
||||
|
||||
|
||||
@@ -59,6 +59,11 @@ class SendComponentUpdateEmailNotificationHandler
|
||||
{
|
||||
$component = $event->component;
|
||||
|
||||
// Don't email anything if the status hasn't changed.
|
||||
if ($event->original_status === $event->new_status) {
|
||||
return;
|
||||
}
|
||||
|
||||
// First notify all global subscribers.
|
||||
$globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user