Symfony upgrade

This commit is contained in:
Ernest Wiśniewski 2023-04-15 15:06:09 +02:00
parent d0ac32dea2
commit a5f15a0b55
92 changed files with 1241 additions and 1002 deletions

View file

@ -12,9 +12,9 @@
"ext-iconv": "*",
"ext-intl": "*",
"ext-openssl": "*",
"api-platform/core": "^2.6",
"api-platform/core": "^2.7",
"aws/aws-sdk-php": "^3.250",
"babdev/pagerfanta-bundle": "^3.7",
"babdev/pagerfanta-bundle": "^v4.0.0",
"composer/package-versions-deprecated": "1.11.99.5",
"debril/rss-atom-bundle": "^5.1",
"doctrine/annotations": "^1.0",
@ -39,51 +39,57 @@
"league/oauth2-github": "^3.0",
"league/oauth2-google": "^4.0",
"lexik/jwt-authentication-bundle": "^2.11",
"liip/imagine-bundle": "^2.8",
"liip/imagine-bundle": "^2.0",
"neitanod/forceutf8": "^2.0",
"nelmio/cors-bundle": "^2.1",
"nucleos/antispam-bundle": "^2.1",
"oneup/flysystem-bundle": "^4.4",
"pagerfanta/core": "^3.1",
"pagerfanta/doctrine-collections-adapter": "^4.0",
"pagerfanta/doctrine-dbal-adapter": "^4.0",
"pagerfanta/doctrine-orm-adapter": "^4.0",
"pagerfanta/twig": "^4.0",
"phpdocumentor/reflection-docblock": "^5.2",
"phpstan/phpdoc-parser": "^0.4.9",
"scienta/doctrine-json-functions": "^5.2",
"sensio/framework-extra-bundle": "^6.2",
"slevomat/coding-standard": "^6.4",
"squizlabs/php_codesniffer": "^3.5",
"symfony/asset": "6.1.*",
"symfony/cache": "6.1.*",
"symfony/console": "6.1.*",
"symfony/css-selector": "6.1.*",
"symfony/doctrine-messenger": "6.1.*",
"symfony/dotenv": "6.1.*",
"symfony/expression-language": "6.1.*",
"symfony/asset": "6.2.*",
"symfony/cache": "6.2.*",
"symfony/console": "6.2.*",
"symfony/css-selector": "6.2.*",
"symfony/doctrine-messenger": "6.2.*",
"symfony/dotenv": "6.2.*",
"symfony/expression-language": "6.2.*",
"symfony/flex": "^2.2.2",
"symfony/form": "6.1.*",
"symfony/framework-bundle": "6.1.*",
"symfony/mailer": "6.1.*",
"symfony/mailgun-mailer": "6.1.*",
"symfony/form": "6.2.*",
"symfony/framework-bundle": "6.2.*",
"symfony/lock": "6.2.*",
"symfony/mailer": "6.2.*",
"symfony/mailgun-mailer": "6.2.*",
"symfony/mercure-bundle": "0.3.*",
"symfony/messenger": "6.1.*",
"symfony/mime": "6.1.*",
"symfony/messenger": "6.2.*",
"symfony/mime": "6.2.*",
"symfony/monolog-bundle": "^3.6",
"symfony/property-access": "6.1.*",
"symfony/property-info": "6.1.*",
"symfony/proxy-manager-bridge": "6.1.*",
"symfony/rate-limiter": "6.1.*",
"symfony/runtime": "6.1.*",
"symfony/security-bundle": "6.1.*",
"symfony/serializer": "6.1.*",
"symfony/string": "6.1.*",
"symfony/translation": "6.1.*",
"symfony/twig-bundle": "6.1.*",
"symfony/uid": "6.1.*",
"symfony/property-access": "6.2.*",
"symfony/property-info": "6.2.*",
"symfony/proxy-manager-bridge": "6.2.*",
"symfony/rate-limiter": "6.2.*",
"symfony/runtime": "6.2.*",
"symfony/security-bundle": "6.2.*",
"symfony/serializer": "6.2.*",
"symfony/string": "6.2.*",
"symfony/translation": "6.2.*",
"symfony/twig-bundle": "6.2.*",
"symfony/uid": "6.2.*",
"symfony/ux-autocomplete": "^2.7",
"symfony/ux-chartjs": "^2.7",
"symfony/ux-twig-component": "^2.7",
"symfony/validator": "6.1.*",
"symfony/validator": "6.2.*",
"symfony/webpack-encore-bundle": "^1.8",
"symfony/workflow": "6.1.*",
"symfony/yaml": "6.1.*",
"symfony/workflow": "6.2.*",
"symfony/yaml": "6.2.*",
"symfonycasts/reset-password-bundle": "^1.13",
"symfonycasts/verify-email-bundle": "^1.2",
"tchoulom/view-counter-bundle": "^6.0",
@ -99,8 +105,8 @@
"fzaninotto/faker": "^1.9",
"justinrainbow/json-schema": "^5.2",
"phpstan/phpstan": "^1.9",
"symfony/browser-kit": "6.1.*",
"symfony/http-client": "6.1.*",
"symfony/browser-kit": "6.2.*",
"symfony/http-client": "6.2.*",
"symfony/maker-bundle": "^1.27",
"symfony/phpunit-bridge": "^6.1",
"symfony/stopwatch": "^6.1",
@ -150,7 +156,7 @@
"extra": {
"symfony": {
"allow-contrib": false,
"require": "6.1.*"
"require": "6.2.*"
}
}
}

1647
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,15 @@
api_platform:
mapping:
paths:
- '%kernel.project_dir%/src/DTO'
- '%kernel.project_dir%/config/kbin_api'
patch_formats:
json: ['application/merge-patch+json']
swagger:
versions: [3]
formats:
jsonld: ['application/ld+json']
metadata_backward_compatibility_layer: false
defaults:
normalization_context:
skip_null_values: true
mapping:
paths:
- '%kernel.project_dir%/src/DTO'
- '%kernel.project_dir%/config/kbin_api'
patch_formats:
json: [ 'application/merge-patch+json' ]
swagger:
versions: [ 3 ]
formats:
jsonld: [ 'application/ld+json' ]

View file

@ -1,7 +1,6 @@
framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
#http_method_override: true
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.

View file

@ -1,5 +1,4 @@
security:
enable_authenticator_manager: true
password_hashers:
App\Entity\User:
algorithm: auto

4
config/packages/uid.yaml Normal file
View file

@ -0,0 +1,4 @@
framework:
uid:
default_uuid_version: 7
time_based_uuid_version: 7

View file

@ -48,12 +48,12 @@ parameters:
env(MONGODB_URL): ''
env(MONGODB_DB): ''
elastica_enabled: '%env(bool:ELASTICSEARCH_ENABLED)%'
# elastica_enabled: false
elastica_listener:
insert: '%elastica_enabled%'
update: '%elastica_enabled%'
delete: '%elastica_enabled%'
# elastica_enabled: '%env(bool:ELASTICSEARCH_ENABLED)%'
# # elastica_enabled: false
# elastica_listener:
# insert: '%elastica_enabled%'
# update: '%elastica_enabled%'
# delete: '%elastica_enabled%'
cardano_wallet_url: '%env(CARDANO_WALLET_URL)%'
cardano_explorer_url: '%env(CARDANO_EXPLORER_URL)%'
@ -63,7 +63,6 @@ services:
autowire: true
autoconfigure: true
bind:
$elasticaEnabled: '%elastica_enabled%'
$html5Validation: '%html5_validation%'
$uploadedAssetsBaseUrl: '%uploads_base_url%'
$cardanoWalletUrl: '%cardano_wallet_url%'

View file

@ -8,7 +8,7 @@ use ApiPlatform\Core\DataPersister\ContextAwareDataPersisterInterface;
use App\DTO\EntryCommentDto;
use App\Factory\EntryCommentFactory;
use App\Service\EntryCommentManager;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
final class EntryCommentDataPersister implements ContextAwareDataPersisterInterface
{

View file

@ -8,7 +8,7 @@ use ApiPlatform\Core\DataPersister\ContextAwareDataPersisterInterface;
use App\DTO\EntryDto;
use App\Factory\EntryFactory;
use App\Service\EntryManager;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
final class EntryDataPersister implements ContextAwareDataPersisterInterface
{

View file

@ -8,7 +8,7 @@ use ApiPlatform\Core\DataPersister\ContextAwareDataPersisterInterface;
use App\DTO\MagazineDto;
use App\Factory\MagazineFactory;
use App\Service\MagazineManager;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
final class MagazineDataPersister implements ContextAwareDataPersisterInterface
{

View file

@ -8,7 +8,7 @@ use ApiPlatform\Core\DataPersister\ContextAwareDataPersisterInterface;
use App\DTO\PostCommentDto;
use App\Factory\PostCommentFactory;
use App\Service\PostCommentManager;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
final class PostCommentDataPersister implements ContextAwareDataPersisterInterface
{

View file

@ -8,7 +8,7 @@ use ApiPlatform\Core\DataPersister\ContextAwareDataPersisterInterface;
use App\DTO\PostDto;
use App\Factory\PostFactory;
use App\Service\PostManager;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
final class PostDataPersister implements ContextAwareDataPersisterInterface
{

View file

@ -5,9 +5,10 @@ namespace App\Command\Update\Async;
use App\Entity\Image;
use App\Service\ImageManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
class ImageBlurhashHandler implements MessageHandlerInterface
#[AsMessageHandler]
class ImageBlurhashHandler
{
public function __construct(
private readonly EntityManagerInterface $entityManager,

View file

@ -7,10 +7,11 @@ use App\Entity\Post;
use App\Entity\PostComment;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Contracts\HttpClient\HttpClientInterface;
class NoteVisibilityHandler implements MessageHandlerInterface
#[AsMessageHandler]
class NoteVisibilityHandler
{
public function __construct(
private readonly EntityManagerInterface $entityManager,

View file

@ -94,10 +94,10 @@ class Image
return $this->fileName;
}
public function getSha256(): string
{
return bin2hex($this->sha256);
}
// public function getSha256(): string
// {
// return bin2hex($this->sha256);
// }
public function __sleep()
{

View file

@ -9,7 +9,7 @@ use Doctrine\ORM\EntityManagerInterface;
use JetBrains\PhpStorm\NoReturn;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
class UserActivityListener
{

View file

@ -21,7 +21,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\ViewEvent;
use Symfony\Component\HttpKernel\KernelEvents;
final class ApiEventSubscriber implements EventSubscriberInterface
final class ApiEventSubscriber
{
public function __construct(
private readonly MagazineFactory $magazineFactory,

View file

@ -15,7 +15,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\ViewEvent;
use Symfony\Component\HttpKernel\KernelEvents;
final class BestCommentsApiSubscriber implements EventSubscriberInterface
final class BestCommentsApiSubscriber
{
public function __construct(
private readonly PostRepository $repository,

View file

@ -10,7 +10,7 @@ use Symfony\Component\HttpKernel\Event\ViewEvent;
use Symfony\Component\HttpKernel\KernelEvents;
// @todo serialization temporary fix
final class BestCommentsFixApiSubscriber implements EventSubscriberInterface
final class BestCommentsFixApiSubscriber
{
public static function getSubscribedEvents(): array
{

View file

@ -11,7 +11,7 @@ use App\Repository\NotificationRepository;
use Doctrine\ORM\EntityManagerInterface;
use JetBrains\PhpStorm\ArrayShape;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
use Tchoulom\ViewCounterBundle\Counter\ViewCounter as Counter;
class EntryShowSubscriber implements EventSubscriberInterface

View file

@ -11,7 +11,7 @@ use App\Repository\NotificationRepository;
use Doctrine\ORM\EntityManagerInterface;
use JetBrains\PhpStorm\ArrayShape;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
class PostShowSubscriber implements EventSubscriberInterface
{

View file

@ -8,7 +8,7 @@ use App\Repository\UserRepository;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
final class DisableFieldsOnUserEdit implements EventSubscriberInterface
{

View file

@ -13,7 +13,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
class UserEmailType extends AbstractType
{

View file

@ -6,9 +6,10 @@ namespace App\MessageHandler\ActivityPub;
use App\Message\ActivityPub\CreateActorMessage;
use App\Service\ActivityPubManager;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
class CreateActorHandler implements MessageHandlerInterface
#[AsMessageHandler]
class CreateActorHandler
{
public function __construct(private readonly ActivityPubManager $activityPubManager)
{

View file

@ -15,10 +15,11 @@ use App\Message\ActivityPub\Inbox\UpdateMessage;
use App\Service\ActivityPub\SignatureValidator;
use App\Service\ActivityPubManager;
use Psr\Log\LoggerInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;
class ActivityHandler implements MessageHandlerInterface
#[AsMessageHandler]
class ActivityHandler
{
public function __construct(
private readonly SignatureValidator $signatureValidator,
@ -77,7 +78,7 @@ class ActivityHandler implements MessageHandlerInterface
case 'Article':
case 'Question':
$this->bus->dispatch(new CreateMessage($payload));
// no break
// no break
case 'Announce':
$this->bus->dispatch(new AnnounceMessage($payload));
break;

View file

@ -13,10 +13,11 @@ use App\Service\ActivityPub\ApHttpClient;
use App\Service\ActivityPubManager;
use App\Service\VoteManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;
class AnnounceHandler implements MessageHandlerInterface
#[AsMessageHandler]
class AnnounceHandler
{
public function __construct(
private readonly ActivityPubManager $activityPubManager,
@ -35,7 +36,7 @@ class AnnounceHandler implements MessageHandlerInterface
$activity = $this->repository->findByObjectId($message->payload['object']);
if ($activity) {
$entity = $this->entityManager->getRepository($activity['type'])->find((int) $activity['id']);
$entity = $this->entityManager->getRepository($activity['type'])->find((int)$activity['id']);
} else {
$object = $this->apHttpClient->getActivityObject($message->payload['object']);

View file

@ -11,10 +11,11 @@ use App\Repository\ApActivityRepository;
use App\Service\ActivityPub\ApHttpClient;
use App\Service\ActivityPub\Note;
use App\Service\ActivityPub\Page;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;
class ChainActivityHandler implements MessageHandlerInterface
#[AsMessageHandler]
class ChainActivityHandler
{
public function __construct(
private readonly ApHttpClient $client,

View file

@ -9,10 +9,11 @@ use App\Message\ActivityPub\Inbox\CreateMessage;
use App\Repository\ApActivityRepository;
use App\Service\ActivityPub\Note;
use App\Service\ActivityPub\Page;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;
class CreateHandler implements MessageHandlerInterface
#[AsMessageHandler]
class CreateHandler
{
private array $object;

View file

@ -18,9 +18,10 @@ use App\Service\PostCommentManager;
use App\Service\PostManager;
use Doctrine\ORM\EntityManagerInterface;
use Exception;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
class DeleteHandler implements MessageHandlerInterface
#[AsMessageHandler]
class DeleteHandler
{
public function __construct(
private readonly ActivityPubManager $activityPubManager,
@ -51,7 +52,7 @@ class DeleteHandler implements MessageHandlerInterface
return;
}
$object = $this->entityManager->getRepository($object['type'])->find((int) $object['id']);
$object = $this->entityManager->getRepository($object['type'])->find((int)$object['id']);
if (Entry::class === get_class($object)) {
$fn = 'deleteEntry';

View file

@ -13,9 +13,10 @@ use App\Service\ActivityPubManager;
use App\Service\MagazineManager;
use App\Service\UserManager;
use JetBrains\PhpStorm\ArrayShape;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
class FollowHandler implements MessageHandlerInterface
#[AsMessageHandler]
class FollowHandler
{
public function __construct(
private readonly ActivityPubManager $activityPubManager,
@ -85,18 +86,18 @@ class FollowHandler implements MessageHandlerInterface
'actor' => 'mixed',
'object' => 'mixed',
])]
private function accept(
private function accept(
array $payload,
User $object
): void {
$accept = $this->acceptWrapper->build(
$payload['object'],
$payload['actor'],
$payload['id'],
);
$accept = $this->acceptWrapper->build(
$payload['object'],
$payload['actor'],
$payload['id'],
);
$this->client->post($this->client->getInboxUrl($payload['actor']), $object, $accept);
}
$this->client->post($this->client->getInboxUrl($payload['actor']), $object, $accept);
}
private function handleUnfollow(User|Magazine $object, User $actor): void
{

View file

@ -11,10 +11,11 @@ use App\Service\ActivityPub\ApHttpClient;
use App\Service\ActivityPubManager;
use App\Service\FavouriteManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;
class LikeHandler implements MessageHandlerInterface
#[AsMessageHandler]
class LikeHandler
{
public function __construct(
private readonly ActivityPubManager $activityPubManager,
@ -32,7 +33,7 @@ class LikeHandler implements MessageHandlerInterface
$activity = $this->repository->findByObjectId($message->payload['object']);
if ($activity) {
$entity = $this->entityManager->getRepository($activity['type'])->find((int) $activity['id']);
$entity = $this->entityManager->getRepository($activity['type'])->find((int)$activity['id']);
} else {
$object = $this->apHttpClient->getActivityObject($message->payload['object']);
@ -49,7 +50,7 @@ class LikeHandler implements MessageHandlerInterface
if ('Undo' === $message->payload['type']) {
if ('Like' === $message->payload['object']['type']) {
$activity = $this->repository->findByObjectId($message->payload['object']['object']);
$entity = $this->entityManager->getRepository($activity['type'])->find((int) $activity['id']);
$entity = $this->entityManager->getRepository($activity['type'])->find((int)$activity['id']);
$actor = $this->activityPubManager->findActorOrCreate($message->payload['actor']);
$this->manager->toggle($actor, $entity, FavouriteManager::TYPE_UNLIKE);

View file

@ -23,10 +23,11 @@ use App\Service\PostCommentManager;
use App\Service\PostManager;
use Doctrine\ORM\EntityManagerInterface;
use Exception;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;
class UpdateHandler implements MessageHandlerInterface
#[AsMessageHandler]
class UpdateHandler
{
private array $payload;
@ -63,7 +64,7 @@ class UpdateHandler implements MessageHandlerInterface
return;
}
$object = $this->entityManager->getRepository($object['type'])->find((int) $object['id']);
$object = $this->entityManager->getRepository($object['type'])->find((int)$object['id']);
if (Entry::class === get_class($object)) {
$fn = 'editEntry';

View file

@ -15,10 +15,11 @@ use App\Service\ActivityPubManager;
use App\Service\SettingsManager;
use Doctrine\ORM\EntityManagerInterface;
use JetBrains\PhpStorm\ArrayShape;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;
class AnnounceHandler implements MessageHandlerInterface
#[AsMessageHandler]
class AnnounceHandler
{
public function __construct(
private readonly UserRepository $userRepository,
@ -39,29 +40,29 @@ class AnnounceHandler implements MessageHandlerInterface
'actor' => 'string',
'object' => 'string',
])]
public function __invoke(
public function __invoke(
AnnounceMessage $message
): void {
if (!$this->settingsManager->get('KBIN_FEDERATION_ENABLED')) {
return;
}
if (!$this->settingsManager->get('KBIN_FEDERATION_ENABLED')) {
return;
}
$user = $this->userRepository->find($message->userId);
$object = $this->entityManager->getRepository($message->objectType)->find($message->objectId);
$user = $this->userRepository->find($message->userId);
$object = $this->entityManager->getRepository($message->objectType)->find($message->objectId);
$activity = $this->announceWrapper->build(
$this->activityPubManager->getActorProfileId($user),
$this->activityFactory->create($object),
);
$activity = $this->announceWrapper->build(
$this->activityPubManager->getActorProfileId($user),
$this->activityFactory->create($object),
);
if ($message->removeAnnounce) {
$activity = $this->undoWrapper->build($activity);
}
if ($message->removeAnnounce) {
$activity = $this->undoWrapper->build($activity);
}
$this->deliver($this->userRepository->findAudience($user), $activity);
$this->deliver($this->activityPubManager->createCcFromObject($activity, $user), $activity);
$this->deliver($this->magazineRepository->findAudience($object->magazine), $activity);
}
$this->deliver($this->userRepository->findAudience($user), $activity);
$this->deliver($this->activityPubManager->createCcFromObject($activity, $user), $activity);
$this->deliver($this->magazineRepository->findAudience($object->magazine), $activity);
}
private function deliver(array $followers, array $activity)
{

View file

@ -12,10 +12,11 @@ use App\Service\ActivityPub\Wrapper\CreateWrapper;
use App\Service\ActivityPubManager;
use App\Service\SettingsManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;
class CreateHandler implements MessageHandlerInterface
#[AsMessageHandler]
class CreateHandler
{
public function __construct(
private readonly MessageBusInterface $bus,

View file

@ -12,11 +12,12 @@ use App\Service\ActivityPub\Wrapper\DeleteWrapper;
use App\Service\ActivityPubManager;
use App\Service\SettingsManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;
use Symfony\Component\Uid\Uuid;
class DeleteHandler implements MessageHandlerInterface
#[AsMessageHandler]
class DeleteHandler
{
public function __construct(
private readonly EntityManagerInterface $entityManager,

View file

@ -11,9 +11,10 @@ use App\Service\ActivityPub\ApHttpClient;
use App\Service\ActivityPubManager;
use App\Service\SettingsManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
class DeliverHandler implements MessageHandlerInterface
#[AsMessageHandler]
class DeliverHandler
{
public function __construct(
private readonly ApHttpClient $client,

View file

@ -13,9 +13,10 @@ use App\Service\ActivityPub\Wrapper\UndoWrapper;
use App\Service\ActivityPubManager;
use App\Service\SettingsManager;
use JetBrains\PhpStorm\ArrayShape;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
class FollowHandler implements MessageHandlerInterface
#[AsMessageHandler]
class FollowHandler
{
public function __construct(
private readonly UserRepository $userRepository,
@ -34,31 +35,31 @@ class FollowHandler implements MessageHandlerInterface
'actor' => 'string',
'object' => 'string',
])]
public function __invoke(
public function __invoke(
FollowMessage $message
): void {
if (!$this->settingsManager->get('KBIN_FEDERATION_ENABLED')) {
return;
}
if (!$this->settingsManager->get('KBIN_FEDERATION_ENABLED')) {
return;
}
$follower = $this->userRepository->find($message->followerId);
if ($message->magazine) {
$following = $this->magazineRepository->find($message->followingId);
} else {
$following = $this->userRepository->find($message->followingId);
}
$follower = $this->userRepository->find($message->followerId);
if ($message->magazine) {
$following = $this->magazineRepository->find($message->followingId);
} else {
$following = $this->userRepository->find($message->followingId);
}
$followObject = $this->followWrapper->build(
$this->activityPubManager->getActorProfileId($follower),
$followingProfileId = $this->activityPubManager->getActorProfileId($following),
);
$followObject = $this->followWrapper->build(
$this->activityPubManager->getActorProfileId($follower),
$followingProfileId = $this->activityPubManager->getActorProfileId($following),
);
if ($message->unfollow) {
$followObject = $this->undoWrapper->build($followObject);
}
if ($message->unfollow) {
$followObject = $this->undoWrapper->build($followObject);
}
$inbox = $this->apHttpClient->getInboxUrl($followingProfileId);
$inbox = $this->apHttpClient->getInboxUrl($followingProfileId);
$this->apHttpClient->post($inbox, $follower, $followObject);
}
$this->apHttpClient->post($inbox, $follower, $followObject);
}
}

View file

@ -15,10 +15,11 @@ use App\Service\ActivityPubManager;
use App\Service\SettingsManager;
use Doctrine\ORM\EntityManagerInterface;
use JetBrains\PhpStorm\ArrayShape;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;
class LikeHandler implements MessageHandlerInterface
#[AsMessageHandler]
class LikeHandler
{
public function __construct(
private readonly UserRepository $userRepository,
@ -39,29 +40,29 @@ class LikeHandler implements MessageHandlerInterface
'actor' => 'string',
'object' => 'string',
])]
public function __invoke(
public function __invoke(
LikeMessage $message
): void {
if (!$this->settingsManager->get('KBIN_FEDERATION_ENABLED')) {
return;
}
if (!$this->settingsManager->get('KBIN_FEDERATION_ENABLED')) {
return;
}
$user = $this->userRepository->find($message->userId);
$object = $this->entityManager->getRepository($message->objectType)->find($message->objectId);
$user = $this->userRepository->find($message->userId);
$object = $this->entityManager->getRepository($message->objectType)->find($message->objectId);
$activity = $this->likeWrapper->build(
$this->activityPubManager->getActorProfileId($user),
$this->activityFactory->create($object),
);
$activity = $this->likeWrapper->build(
$this->activityPubManager->getActorProfileId($user),
$this->activityFactory->create($object),
);
if ($message->removeLike) {
$activity = $this->undoWrapper->build($activity);
}
if ($message->removeLike) {
$activity = $this->undoWrapper->build($activity);
}
$this->deliver($this->userRepository->findAudience($user), $activity);
$this->deliver($this->userRepository->findAudience($user), $activity);
$this->deliver($this->magazineRepository->findAudience($object->magazine), $activity);
}
$this->deliver($this->userRepository->findAudience($user), $activity);
$this->deliver($this->userRepository->findAudience($user), $activity);
$this->deliver($this->magazineRepository->findAudience($object->magazine), $activity);
}
private function deliver(array $followers, array $activity)
{

View file

@ -13,11 +13,12 @@ use App\Service\ActivityPub\Wrapper\CreateWrapper;
use App\Service\ActivityPubManager;
use App\Service\SettingsManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\MessageBusInterface;
use Symfony\Component\Uid\Uuid;
class UpdateHandler implements MessageHandlerInterface
#[AsMessageHandler]
class UpdateHandler
{
public function __construct(
private readonly MessageBusInterface $bus,

View file

@ -6,9 +6,10 @@ namespace App\MessageHandler\ActivityPub;
use App\Message\ActivityPub\UpdateActorMessage;
use App\Service\ActivityPubManager;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
class UpdateActorHandler implements MessageHandlerInterface
#[AsMessageHandler]
class UpdateActorHandler
{
public function __construct(private readonly ActivityPubManager $manager)
{

View file

@ -12,10 +12,11 @@ use App\Repository\ImageRepository;
use App\Service\ImageManager;
use App\Utils\Embed;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class AttachEntryEmbedHandler implements MessageHandlerInterface
#[AsMessageHandler]
class AttachEntryEmbedHandler
{
public function __construct(
private readonly EntryRepository $entryRepository,

View file

@ -13,9 +13,10 @@ use App\Repository\CardanoTxInitRepository;
use App\Repository\CardanoTxRepository;
use App\Repository\UserRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
class SubjectTransactionsRefreshHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SubjectTransactionsRefreshHandler
{
public function __construct(
private readonly CardanoExplorer $explorer,
@ -78,7 +79,7 @@ class SubjectTransactionsRefreshHandler implements MessageHandlerInterface
$sender = $this->userRepository->findOneBy(['cardanoWalletAddress' => $senderAddress]);
return new EntryCardanoTx($subject, (int) $amount, $txHash, $createdAt, $sender);
return new EntryCardanoTx($subject, (int)$amount, $txHash, $createdAt, $sender);
}
return null;

View file

@ -9,9 +9,10 @@ use App\Repository\ImageRepository;
use App\Service\ImageManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
class DeleteImageHandler implements MessageHandlerInterface
#[AsMessageHandler]
class DeleteImageHandler
{
public function __construct(
private readonly ImageRepository $imageRepository,

View file

@ -25,11 +25,12 @@ use App\Service\PostManager;
use App\Service\UserManager;
use App\Service\VoteManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\MessageBusInterface;
class DeleteUserHandler implements MessageHandlerInterface
#[AsMessageHandler]
class DeleteUserHandler
{
private ?User $user;
private int $batchSize = 5;

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\EntryCommentCreatedNotificationMessage;
use App\Repository\EntryCommentRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentEntryCommentCreatedNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentEntryCommentCreatedNotificationHandler
{
public function __construct(
private readonly EntryCommentRepository $repository,

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\EntryCommentDeletedNotificationMessage;
use App\Repository\EntryCommentRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentEntryCommentDeletedNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentEntryCommentDeletedNotificationHandler
{
public function __construct(
private readonly EntryCommentRepository $repository,

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\EntryCommentEditedNotificationMessage;
use App\Repository\EntryCommentRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentEntryCommentEditedNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentEntryCommentEditedNotificationHandler
{
public function __construct(
private readonly EntryCommentRepository $repository,

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\EntryCreatedNotificationMessage;
use App\Repository\EntryRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentEntryCreatedNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentEntryCreatedNotificationHandler
{
public function __construct(
private readonly EntryRepository $repository,

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\EntryDeletedNotificationMessage;
use App\Repository\EntryRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentEntryDeletedNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentEntryDeletedNotificationHandler
{
public function __construct(
private readonly EntryRepository $repository,

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\EntryEditedNotificationMessage;
use App\Repository\EntryRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentEntryEditedNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentEntryEditedNotificationHandler
{
public function __construct(
private readonly EntryRepository $repository,

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\MessageHandler\Notification;
use ApiPlatform\Core\Api\IriConverterInterface;
use ApiPlatform\Api\IriConverterInterface;
use App\Entity\Contracts\FavouriteInterface;
use App\Factory\MagazineFactory;
use App\Message\Notification\FavouriteNotificationMessage;
@ -12,9 +12,10 @@ use App\Service\GenerateHtmlClassService;
use App\Service\VotableRepositoryResolver;
use Symfony\Component\Mercure\HubInterface;
use Symfony\Component\Mercure\Update;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
class SentFavouriteNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentFavouriteNotificationHandler
{
public function __construct(
private readonly IriConverterInterface $iriConverter,
@ -34,7 +35,7 @@ class SentFavouriteNotificationHandler implements MessageHandlerInterface
private function notifyMagazine(FavouriteInterface $subject): void
{
try {
$iri = $this->iriConverter->getIriFromItem($this->magazineFactory->createDto($subject->magazine));
$iri = $this->iriConverter->getIriFromResource($this->magazineFactory->createDto($subject->magazine));
$update = new Update(
['pub', $iri],

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\MagazineBanNotificationMessage;
use App\Repository\MagazineBanRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentMagazineBanNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentMagazineBanNotificationHandler
{
public function __construct(
private readonly MagazineBanRepository $repository,

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\PostCommentCreatedNotificationMessage;
use App\Repository\PostCommentRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentPostCommentCreatedNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentPostCommentCreatedNotificationHandler
{
public function __construct(
private readonly PostCommentRepository $repository,

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\PostCommentDeletedNotificationMessage;
use App\Repository\PostCommentRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentPostCommentDeletedNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentPostCommentDeletedNotificationHandler
{
public function __construct(
private readonly PostCommentRepository $repository,

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\PostCommentEditedNotificationMessage;
use App\Repository\PostCommentRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentPostCommentEditedNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentPostCommentEditedNotificationHandler
{
public function __construct(
private readonly PostCommentRepository $repository,

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\PostCreatedNotificationMessage;
use App\Repository\PostRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentPostCreatedNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentPostCreatedNotificationHandler
{
public function __construct(
private readonly PostRepository $repository,

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\PostDeletedNotificationMessage;
use App\Repository\PostRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentPostDeletedNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentPostDeletedNotificationHandler
{
public function __construct(
private readonly PostRepository $repository,

View file

@ -7,10 +7,11 @@ namespace App\MessageHandler\Notification;
use App\Message\Notification\PostEditedNotificationMessage;
use App\Repository\PostRepository;
use App\Service\NotificationManager;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
class SentPostEditedNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentPostEditedNotificationHandler
{
public function __construct(
private readonly PostRepository $repository,

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\MessageHandler\Notification;
use ApiPlatform\Core\Api\IriConverterInterface;
use ApiPlatform\Api\IriConverterInterface;
use App\Entity\Contracts\VotableInterface;
use App\Factory\MagazineFactory;
use App\Message\Notification\VoteNotificationMessage;
@ -12,9 +12,10 @@ use App\Service\GenerateHtmlClassService;
use App\Service\VotableRepositoryResolver;
use Symfony\Component\Mercure\HubInterface;
use Symfony\Component\Mercure\Update;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
class SentVoteNotificationHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentVoteNotificationHandler
{
public function __construct(
private readonly IriConverterInterface $iriConverter,
@ -34,7 +35,7 @@ class SentVoteNotificationHandler implements MessageHandlerInterface
private function notifyMagazine(VotableInterface $votable): void
{
try {
$iri = $this->iriConverter->getIriFromItem($this->magazineFactory->createDto($votable->magazine));
$iri = $this->iriConverter->getIriFromResource($this->magazineFactory->createDto($votable->magazine));
$update = new Update(
['pub', $iri],

View file

@ -10,12 +10,13 @@ use App\Security\EmailVerifier;
use App\Service\SettingsManager;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Mime\Address;
use Symfony\Contracts\Translation\TranslatorInterface;
class SentUserConfirmationEmailHandler implements MessageHandlerInterface
#[AsMessageHandler]
class SentUserConfirmationEmailHandler
{
public function __construct(
private readonly SettingsManager $settingsManager,
@ -40,7 +41,9 @@ class SentUserConfirmationEmailHandler implements MessageHandlerInterface
'app_verify_email',
$user,
(new TemplatedEmail())
->from(new Address($this->settingsManager->get('KBIN_SENDER_EMAIL'), $this->params->get('kbin_domain')))
->from(
new Address($this->settingsManager->get('KBIN_SENDER_EMAIL'), $this->params->get('kbin_domain'))
)
->to($user->email)
->subject($this->translator->trans('email_confirm_title'))
->htmlTemplate('_email/confirmation_email.html.twig')

View file

@ -26,7 +26,7 @@ use Pagerfanta\Exception\NotValidCurrentPageException;
use Pagerfanta\Pagerfanta;
use Pagerfanta\PagerfantaInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
/**
* @method EntryComment|null find($id, $lockMode = null, $lockVersion = null)

View file

@ -27,7 +27,7 @@ use Pagerfanta\Exception\NotValidCurrentPageException;
use Pagerfanta\Pagerfanta;
use Pagerfanta\PagerfantaInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
/**
* @method Entry|null find($id, $lockMode = null, $lockVersion = null)

View file

@ -21,7 +21,7 @@ use Pagerfanta\Exception\NotValidCurrentPageException;
use Pagerfanta\Pagerfanta;
use Pagerfanta\PagerfantaInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
/**
* @method PostComment|null find($id, $lockMode = null, $lockVersion = null)

View file

@ -24,7 +24,7 @@ use Pagerfanta\Exception\NotValidCurrentPageException;
use Pagerfanta\Pagerfanta;
use Pagerfanta\PagerfantaInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
/**
* @method Post|null find($id, $lockMode = null, $lockVersion = null)

View file

@ -9,7 +9,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Security\Http\Authenticator\AbstractLoginFormAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge;

View file

@ -4,9 +4,9 @@ declare(strict_types=1);
namespace App\Service\ActivityPub;
use ApiPlatform\Core\Api\UrlGeneratorInterface;
use App\Exception\InvalidApSignatureException;
use App\Service\ActivityPubManager;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class SignatureValidator
{

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Service;
use ApiPlatform\Core\Api\IriConverterInterface;
use ApiPlatform\Api\IriConverterInterface;
use App\Entity\Entry;
use App\Factory\EntryFactory;
use App\PageView\EntryPageView;
@ -108,7 +108,7 @@ class FeedManager
'slug' => $entry->slug,
])
);
$item->setPublicId($this->iriConverter->getIriFromItem($this->entryFactory->createDto($entry)));
$item->setPublicId($this->iriConverter->getIriFromResource($this->entryFactory->createDto($entry)));
$item->setAuthor((new Item\Author())->setName($entry->user->username));
yield $item;
}

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Service\Notification;
use ApiPlatform\Core\Api\IriConverterInterface;
use ApiPlatform\Api\IriConverterInterface;
use App\Entity\Contracts\ContentInterface;
use App\Entity\EntryComment;
use App\Entity\EntryCommentCreatedNotification;
@ -110,7 +110,7 @@ class EntryCommentNotificationManager implements ContentNotificationManagerInter
private function notifyUser(EntryCommentReplyNotification $notification): void
{
try {
$iri = $this->iriConverter->getIriFromItem($this->userFactory->createDto($notification->user));
$iri = $this->iriConverter->getIriFromResource($this->userFactory->createDto($notification->user));
$update = new Update(
$iri,
@ -185,7 +185,7 @@ class EntryCommentNotificationManager implements ContentNotificationManagerInter
private function notifyMagazine(Notification $notification): void
{
try {
$iri = $this->iriConverter->getIriFromItem(
$iri = $this->iriConverter->getIriFromResource(
$this->magazineFactory->createDto($notification->getComment()->magazine)
);

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Service\Notification;
use ApiPlatform\Core\Api\IriConverterInterface;
use ApiPlatform\Api\IriConverterInterface;
use App\Entity\Contracts\ContentInterface;
use App\Entity\Entry;
use App\Entity\EntryCreatedNotification;
@ -81,7 +81,7 @@ class EntryNotificationManager implements ContentNotificationManagerInterface
private function notifyMagazine(Notification $notification): void
{
try {
$iri = $this->iriConverter->getIriFromItem(
$iri = $this->iriConverter->getIriFromResource(
$this->magazineFactory->createDto($notification->entry->magazine)
);

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Service\Notification;
use ApiPlatform\Core\Api\IriConverterInterface;
use ApiPlatform\Api\IriConverterInterface;
use App\Entity\Message;
use App\Entity\MessageNotification;
use App\Entity\User;

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Service\Notification;
use ApiPlatform\Core\Api\IriConverterInterface;
use ApiPlatform\Api\IriConverterInterface;
use App\Entity\Contracts\ContentInterface;
use App\Entity\Notification;
use App\Entity\PostComment;
@ -110,7 +110,7 @@ class PostCommentNotificationManager implements ContentNotificationManagerInterf
private function notifyUser(PostCommentReplyNotification $notification): void
{
try {
$iri = $this->iriConverter->getIriFromItem($this->userFactory->createDto($notification->user));
$iri = $this->iriConverter->getIriFromResource($this->userFactory->createDto($notification->user));
$update = new Update(
$iri,
@ -185,7 +185,7 @@ class PostCommentNotificationManager implements ContentNotificationManagerInterf
private function notifyMagazine(Notification $notification): void
{
try {
$iri = $this->iriConverter->getIriFromItem(
$iri = $this->iriConverter->getIriFromResource(
$this->magazineFactory->createDto($notification->getComment()->magazine)
);

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Service\Notification;
use ApiPlatform\Core\Api\IriConverterInterface;
use ApiPlatform\Api\IriConverterInterface;
use App\Entity\Contracts\ContentInterface;
use App\Entity\Notification;
use App\Entity\Post;
@ -78,7 +78,7 @@ class PostNotificationManager implements ContentNotificationManagerInterface
private function notifyMagazine(Notification $notification)
{
try {
$iri = $this->iriConverter->getIriFromItem(
$iri = $this->iriConverter->getIriFromResource(
$this->magazineFactory->createDto($notification->post->magazine)
);

View file

@ -28,7 +28,7 @@ use Symfony\Component\Messenger\MessageBusInterface;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\RateLimiter\RateLimiterFactory;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
class UserManager
{

View file

@ -35,7 +35,7 @@ final class FeaturedMagazinesComponent
array_unshift($magazines, $this->magazine);
}
usort($magazines, fn($a, $b) => $a->lastActive < $b->lastActive);
usort($magazines, fn($a, $b) => $a->lastActive < $b->lastActive ? 1 : -1);
return $this->twig->render(
'components/featured_magazines.html.twig',

View file

@ -3,7 +3,7 @@
namespace App\Twig\Components;
use App\Entity\Post;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
use Symfony\UX\TwigComponent\ComponentAttributes;
use Twig\Environment;

View file

@ -3,7 +3,7 @@
namespace App\Twig\Runtime;
use App\Entity\Domain;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
use Twig\Extension\RuntimeExtensionInterface;
class DomainExtensionRuntime implements RuntimeExtensionInterface

View file

@ -3,7 +3,7 @@
namespace App\Twig\Runtime;
use App\Entity\Magazine;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
use Twig\Extension\RuntimeExtensionInterface;
class MagazineExtensionRuntime implements RuntimeExtensionInterface

View file

@ -5,7 +5,7 @@ namespace App\Twig\Runtime;
use App\Entity\User;
use App\Repository\ReputationRepository;
use App\Service\MentionManager;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
use Twig\Extension\RuntimeExtensionInterface;
class UserExtensionRuntime implements RuntimeExtensionInterface

View file

@ -325,9 +325,6 @@
"oscarotero/html-parser": {
"version": "v0.1.6"
},
"pagerfanta/pagerfanta": {
"version": "v2.7.1"
},
"paragonie/constant_time_encoding": {
"version": "v2.4.0"
},
@ -513,12 +510,12 @@
"version": "v5.3.0"
},
"symfony/lock": {
"version": "5.2",
"version": "6.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"branch": "main",
"version": "5.2",
"ref": "a1c8800e40ae735206bb14586fdd6c4630a51b8d"
"ref": "8e937ff2b4735d110af1770f242c1107fdab4c8e"
},
"files": [
"config/packages/lock.yaml"
@ -740,6 +737,18 @@
"templates/base.html.twig"
]
},
"symfony/uid": {
"version": "6.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.2",
"ref": "d294ad4add3e15d7eb1bae0221588ca89b38e558"
},
"files": [
"config/packages/uid.yaml"
]
},
"symfony/ux-autocomplete": {
"version": "2.7",
"recipe": {

View file

@ -25,6 +25,9 @@
{% endif %}
{% if showMagazineName %}{{ 'to'|trans }} {{ component('magazine_inline', {magazine: comment.magazine}) }}{% endif %}
{% if showEntryTitle %}{{ 'in'|trans }} {{ component('entry_inline', {entry: comment.entry}) }}{% endif %}
{% if comment.lang is not same as kbin_default_lang() %}
<small hidden class="badge">{{ comment.lang }}</small>
{% endif %}
</header>
{% if comment.user.avatar %}
{{ component('user_avatar', {

View file

@ -27,6 +27,9 @@
{{ component('date', {date: post.createdAt}) }}
{% endif %}
{% if showMagazineName %}{{ 'to'|trans }} {{ component('magazine_inline', {magazine: post.magazine}) }}{% endif %}
{% if post.lang is not same as kbin_default_lang() %}
<small hidden class="badge">{{ post.lang }}</small>
{% endif %}
</header>
{% if post.user.avatar %}
{{ component('user_avatar', {

View file

@ -26,6 +26,9 @@
{% else %}
{{ component('date', {date: comment.createdAt}) }}
{% endif %}
{# {% if comment.lang is not same as kbin_default_lang() %}#}
<small class="badge">{{ comment.lang }}</small>
{# {% endif %}#}
</header>
{% if comment.user.avatar %}
{{ component('user_avatar', {

View file

@ -16,7 +16,6 @@
<div id="content">
{{ component('entry_comment', {
comment: comment,
showModeratePanel: true
}) }}
{% include 'entry/comment/_moderate_panel.html.twig' %}
</div>

View file

@ -20,7 +20,6 @@
showShortSentence: false,
showBody:true,
moderate:true,
showModeratePanel: true,
class: 'section--top'
}) }}
{% include 'entry/_moderate_panel.html.twig' %}

View file

@ -14,11 +14,10 @@
{% block body %}
<div id="content">
{{ component('post', {
post: post,
{{ component('post_comment', {
comment: comment,
isSingle: true,
dateAsUrl: false,
showModeratePanel: true,
}) }}
{% include 'post/comment/_moderate_panel.html.twig' %}
</div>

View file

@ -18,7 +18,6 @@
post: post,
isSingle: true,
dateAsUrl: false,
showModeratePanel: true,
class: 'section--top',
}) }}
{% include 'post/_moderate_panel.html.twig' %}

View file

@ -239,6 +239,7 @@ trait FactoryTrait
$dto->user = $user;
$dto->url = $url;
$dto->body = $body;
$dto->lang = 'en';
$entry = $manager->create($dto, $user);
@ -269,6 +270,7 @@ trait FactoryTrait
$dto = new EntryCommentDto();
$dto->entry = $entry ?? $this->getEntryByTitle('test entry content', 'https://kbin.pub');
$dto->body = $body;
$dto->lang = 'en';
}
return $manager->create($dto, $user ?? $this->getUserByUsername('JohnDoe'));
@ -284,6 +286,7 @@ trait FactoryTrait
$dto = new PostDto();
$dto->magazine = $magazine ?: $this->getMagazineByName('acme');
$dto->body = $body;
$dto->lang = 'en';
return $manager->create($dto, $user ?? $this->getUserByUsername('JohnDoe'));
}
@ -298,6 +301,7 @@ trait FactoryTrait
$dto = new PostCommentDto();
$dto->post = $post ?? $this->createPost('test post content');
$dto->body = $body;
$dto->lang = 'en';
return $manager->create($dto, $user ?? $this->getUserByUsername('JohnDoe'));
}

View file

@ -26,6 +26,6 @@ class EntryCommentChangeLangControllerTest extends WebTestCase
$client->submit($form);
$client->followRedirect();
$this->assertSelectorTextContains('select[name="lang[lang]"] option[selected]', 'french');
$this->assertSelectorTextContains('#main .badge', 'fr');
}
}

View file

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Tests\Functional\Controller\Entry;
use App\Entity\Entry;
use App\Tests\WebTestCase;
use Doctrine\ORM\EntityManagerInterface;
@ -30,6 +31,6 @@ class EntryChangeLangControllerTest extends WebTestCase
$client->submit($form);
$client->followRedirect();
$this->assertSelectorTextContains('select[name="lang[lang]"] option[selected]', 'french');
$this->assertSelectorTextContains('#main .badge', 'fr');
}
}

View file

@ -26,6 +26,6 @@ class PostCommentChangeLangControllerTest extends WebTestCase
$client->submit($form);
$client->followRedirect();
$this->assertSelectorTextContains('select[name="lang[lang]"] option[selected]', 'french');
$this->assertSelectorTextContains('#main .badge', 'fr');
}
}

View file

@ -26,6 +26,6 @@ class PostChangeLangControllerTest extends WebTestCase
$client->submit($form);
$client->followRedirect();
$this->assertSelectorTextContains('select[name="lang[lang]"] option[selected]', 'french');
$this->assertSelectorTextContains('#main .badge', 'fr');
}
}

View file

@ -7,6 +7,7 @@ namespace App\Tests\Functional\Controller\User\Profile;
use App\Repository\UserRepository;
use App\Tests\Functional\Controller\Security\RegisterControllerTest;
use App\Tests\WebTestCase;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
class UserEditControllerTest extends WebTestCase
{