Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
datlechin committed Nov 2, 2023
1 parent 0fbce0e commit 84605e1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
10 changes: 8 additions & 2 deletions framework/core/src/Api/Controller/ShowDiscussionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,15 @@ protected function getRelationCallablesToLoad(Collection $models): array

$postCallableRelationships = $this->getPostRelationships(array_keys($addedCallableRelations));

$relationCallables = array_intersect_key($addedCallableRelations, array_flip(array_map(fn ($relation) => "posts.$relation", $postCallableRelationships)));
$relationCallables = array_intersect_key(
$addedCallableRelations,
array_flip(array_map(fn ($relation) => "posts.$relation", $postCallableRelationships))
);

// remove posts. prefix from keys
return array_combine(array_map(fn ($relation) => substr($relation, 6), array_keys($relationCallables)), array_values($relationCallables));
return array_combine(
array_map(fn ($relation) => substr($relation, 6), array_keys($relationCallables)),
array_values($relationCallables)
);
}
}
12 changes: 9 additions & 3 deletions framework/core/src/Extend/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,15 @@ public function extend(Container $container, Extension $extension = null): void
return $existingBlueprints;
});

$container->extend('flarum.api.notification_serializers', fn ($existingSerializers) => array_merge($existingSerializers, $this->serializers));

$container->extend('flarum.notification.drivers', fn ($existingDrivers) => array_merge($existingDrivers, $this->drivers));
$container->extend(
'flarum.api.notification_serializers',
fn ($existingSerializers) => array_merge($existingSerializers, $this->serializers)
);

$container->extend(
'flarum.notification.drivers',
fn ($existingDrivers) => array_merge($existingDrivers, $this->drivers)
);

foreach ($this->beforeSendingCallbacks as $callback) {
NotificationSyncer::beforeSending(ContainerUtil::wrapCallback($callback, $container));
Expand Down
7 changes: 6 additions & 1 deletion framework/core/src/Frontend/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,12 @@ protected function makeHead(): string

$head = array_merge($head, $this->makePreloads());

$head = array_merge($head, array_map(fn ($content, $name) => '<meta name="'.e($name).'" content="'.e($content).'">', $this->meta, array_keys($this->meta)));
$head = array_merge(
$head,
array_map(
fn ($content, $name) => sprintf('<meta name="%s" content="%s">', e($name), e($content)), $this->meta, array_keys($this->meta)
)
);

return implode("\n", array_merge($head, $this->head));
}
Expand Down

0 comments on commit 84605e1

Please sign in to comment.