1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Added ability to adjust stored IP address precision

Included tests to cover.

For #3560
This commit is contained in:
Dan Brown
2022-07-23 13:41:29 +01:00
parent 67d12cc1df
commit 4e8995c3d0
7 changed files with 150 additions and 3 deletions

View File

@@ -40,12 +40,10 @@ class ActivityLogger
*/
protected function newActivityForUser(string $type): Activity
{
$ip = request()->ip() ?? '';
return (new Activity())->forceFill([
'type' => strtolower($type),
'user_id' => user()->id,
'ip' => config('app.env') === 'demo' ? '127.0.0.1' : $ip,
'ip' => IpFormatter::fromCurrentRequest()->format(),
]);
}