Fix client Activity tab issues; fixes #465 (#466)

* Remove deploy.locations from validator

* Change location data to optional for backwards compat

* Better styling

* Add back comma to follow coding style

* Remove EventServiceProvider from providers file

Fixes duplicated auth messages in the client Activity tab.

* Add null check on $model->actor

Prevents the client Activity tab page from breaking when an authentication attempt has failed.

* Proper type checking on $model->actor

Chose instanceof as it seems to be the best in terms of type safety.

Co-authored-by: MartinOscar <40749467+RMartinOscar@users.noreply.github.com>

* Revert removal of EventServiceProvider

* Remove subscription of AuthenticationListener

* Remove subscriptions for auth events

* Remove unused import Dispatcher

* Remove unused import AuthenticationListener

---------

Co-authored-by: MartinOscar <40749467+RMartinOscar@users.noreply.github.com>
This commit is contained in:
Exotical 2024-07-10 06:30:12 +02:00 committed by GitHub
parent 7dad2d0e42
commit 1c1c8c0cc6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 1 additions and 14 deletions

View File

@ -5,7 +5,6 @@ namespace App\Listeners\Auth;
use App\Facades\Activity;
use Illuminate\Auth\Events\Failed;
use App\Events\Auth\DirectLogin;
use Illuminate\Events\Dispatcher;
class AuthenticationListener
{
@ -28,10 +27,4 @@ class AuthenticationListener
$activity->event($event instanceof Failed ? 'auth:fail' : 'auth:success')->log();
}
public function subscribe(Dispatcher $events): void
{
$events->listen(Failed::class, self::class);
$events->listen(DirectLogin::class, self::class);
}
}

View File

@ -10,7 +10,6 @@ use App\Observers\UserObserver;
use App\Observers\ServerObserver;
use App\Observers\SubuserObserver;
use App\Observers\EggVariableObserver;
use App\Listeners\Auth\AuthenticationListener;
use App\Events\Server\Installed as ServerInstalledEvent;
use App\Notifications\ServerInstalled as ServerInstalledNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
@ -24,10 +23,6 @@ class EventServiceProvider extends ServiceProvider
ServerInstalledEvent::class => [ServerInstalledNotification::class],
];
protected $subscribe = [
AuthenticationListener::class,
];
/**
* Register any events for your application.
*/

View File

@ -55,7 +55,7 @@ class ActivityLogTransformer extends BaseClientTransformer
$properties = $model->properties
->mapWithKeys(function ($value, $key) use ($model) {
if ($key === 'ip' && !$model->actor->is($this->request->user())) {
if ($key === 'ip' && $model->actor instanceof User && !$model->actor->is($this->request->user())) {
return [$key => '[hidden]'];
}

View File

@ -8,6 +8,5 @@ return [
App\Providers\Filament\AdminPanelProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\ViewComposerServiceProvider::class,
SocialiteProviders\Manager\ServiceProvider::class,
];