Don't log activity if the email wasn't actually changed

This commit is contained in:
DaneEveritt 2022-07-03 14:29:01 -04:00
parent 2d836156d2
commit 0216e3fd5b
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -50,9 +50,11 @@ class AccountController extends ClientApiController
$original = $request->user()->email;
$this->updateService->handle($request->user(), $request->validated());
if ($original !== $request->input('email')) {
Activity::event('user:account.email-changed')
->property(['old' => $original, 'new' => $request->input('email')])
->log();
}
return new JsonResponse([], Response::HTTP_NO_CONTENT);
}