X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/94bf7e2e0c76bb2156be874c7f4f3e6a0f877e80..refs/pull/3918/head:/app/Actions/ActivityLogger.php diff --git a/app/Actions/ActivityLogger.php b/app/Actions/ActivityLogger.php index eea5409fb..6ece47fd5 100644 --- a/app/Actions/ActivityLogger.php +++ b/app/Actions/ActivityLogger.php @@ -3,7 +3,9 @@ namespace BookStack\Actions; use BookStack\Entities\Models\Entity; +use BookStack\Facades\Theme; use BookStack\Interfaces\Loggable; +use BookStack\Theming\ThemeEvents; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Facades\Log; @@ -27,8 +29,10 @@ class ActivityLogger } $activity->save(); + $this->setNotification($type); $this->dispatchWebhooks($type, $detail); + Theme::dispatch(ThemeEvents::ACTIVITY_LOGGED, $type, $detail); } /** @@ -36,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(), ]); }