1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Reviewed adding IP recording to activity & audit log

Review of #2936

- Added testing to cover
- Added APP_PROXIES to .env.example.complete with details.
- Renamed migration to better align the name and to set the migration
  date to fit with production deploy order.
- Removed index from IP column in migration since an index does not yet
  provide any value.
- Updated table header text label.
- Prevented IP recording when in demo mode.
This commit is contained in:
Dan Brown
2021-09-26 17:18:12 +01:00
parent 8972f7b212
commit 887a79f130
6 changed files with 62 additions and 7 deletions

View File

@ -56,10 +56,11 @@ class ActivityService
*/
protected function newActivityForUser(string $type): Activity
{
$ip = request()->ip() ?? '';
return $this->activity->newInstance()->forceFill([
'type' => strtolower($type),
'user_id' => user()->id,
'ip' => Request::ip(),
'ip' => config('app.env') === 'demo' ? '127.0.0.1' : $ip,
]);
}