Fix metadata coming from wings activity logs (#1284)

This commit is contained in:
Boy132 2025-04-22 22:27:31 +02:00 committed by GitHub
parent 058b613c98
commit 05b1a44a34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,8 +14,6 @@ class ActivityProcessingController extends Controller
{
public function __invoke(ActivityEventRequest $request): void
{
$tz = Carbon::now()->getTimezone();
/** @var \App\Models\Node $node */
$node = $request->attributes->get('node');
@ -49,11 +47,8 @@ class ActivityProcessingController extends Controller
$log = [
'ip' => empty($datum['ip']) ? '127.0.0.1' : $datum['ip'],
'event' => $datum['event'],
'properties' => json_encode($datum['metadata'] ?? []),
// We have to change the time to the current timezone due to the way Laravel is handling
// the date casting internally. If we just leave it in UTC it ends up getting double-cast
// and the time is way off.
'timestamp' => $when->setTimezone($tz),
'properties' => $datum['metadata'] ?? [],
'timestamp' => $when,
];
if ($user = $users->get($datum['user'])) {