Skip to content

Commit 0216e3f

Browse files
committed
Don't log activity if the email wasn't actually changed
1 parent 2d83615 commit 0216e3f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/Http/Controllers/Api/Client/AccountController.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ public function updateEmail(UpdateEmailRequest $request): JsonResponse
5050
$original = $request->user()->email;
5151
$this->updateService->handle($request->user(), $request->validated());
5252

53-
Activity::event('user:account.email-changed')
54-
->property(['old' => $original, 'new' => $request->input('email')])
55-
->log();
53+
if ($original !== $request->input('email')) {
54+
Activity::event('user:account.email-changed')
55+
->property(['old' => $original, 'new' => $request->input('email')])
56+
->log();
57+
}
5658

5759
return new JsonResponse([], Response::HTTP_NO_CONTENT);
5860
}

0 commit comments

Comments
 (0)