Skip to content

Commit

Permalink
fix: default event click authorization
Browse files Browse the repository at this point in the history
fix: default event click authorization
  • Loading branch information
lukas-frey authored Jan 27, 2025
2 parents 93ce7c3 + dca1d0a commit 7769a1d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Concerns/HandlesEventClick.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,16 @@ public function onEventClick(array $info = [], ?string $action = null): void
$key = data_get($info, 'event.extendedProps.key');

if ($model && $key) {
$this->resolveEventRecord(
data_get($info, 'event.extendedProps.model'),
data_get($info, 'event.extendedProps.key'),
);

$this->authorize(match ($action) {
'edit' => 'update',
default => $action,
}, [$this->eventRecord]);
$this->resolveEventRecord($model, $key);

$action ??= data_get($info, 'event.extendedProps.action', $this->getDefaultEventClickAction());

if ($action) {
$this->authorize(match ($action) {
'edit' => 'update',
default => $action,
}, [$this->eventRecord]);

$this->mountAction($action, [
'event' => data_get($info, 'event', []),
]);
Expand Down

0 comments on commit 7769a1d

Please sign in to comment.