diff --git a/app/Models/ActivityLog.php b/app/Models/ActivityLog.php index f86826345..65bab2567 100644 --- a/app/Models/ActivityLog.php +++ b/app/Models/ActivityLog.php @@ -17,6 +17,7 @@ use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Arr; use Illuminate\Support\Str; /** @@ -173,13 +174,14 @@ class ActivityLog extends Model implements HasIcon, HasLabel } $avatarUrl = Filament::getUserAvatarUrl($user); + $username = str($user->username)->stripTags(); return "
-

$user->username — $this->event

+

$username — $this->event

{$this->getLabel()}

$this->ip — {$this->timestamp->diffForHumans()}

@@ -203,17 +205,17 @@ class ActivityLog extends Model implements HasIcon, HasLabel $value = str_replace('//', '/', '/' . trim($value, '/') . '/'); } - return [$key => $value]; + return [$key => str($value)->stripTags()->toString()]; } - $first = array_first($value); + $first = Arr::first($value); // Backwards compatibility for old logs if (is_array($first)) { return ["{$key}_count" => count($value)]; } - return [$key => $first, "{$key}_count" => count($value)]; + return [$key => str($first)->stripTags()->toString(), "{$key}_count" => count($value)]; }); $keys = $properties->keys()->filter(fn ($key) => Str::endsWith($key, '_count'))->values();