Skip to content

Commit

Permalink
Merge branch 'PS-706-discussions' of github.com:alchemy-fr/phrasea in…
Browse files Browse the repository at this point in the history
…to w2502
  • Loading branch information
nmaillat committed Jan 14, 2025
2 parents fff52e0 + e194ad9 commit dfad205
Show file tree
Hide file tree
Showing 118 changed files with 2,396 additions and 1,241 deletions.
1 change: 1 addition & 0 deletions dashboard/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"lint": "eslint src",
"lint:fix": "eslint --fix src",
"format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json|cjs|tsx|jsx)\"",
"cs": "pnpm lint:fix && pnpm format",
"preview": "vite preview"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions databox/api/src/Api/Model/Output/ESDocumentStateOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public function __construct(
private array $data,
#[Groups(['_'])]
private bool $synced,
)
{
) {
}

public function getData(): array
Expand Down
11 changes: 11 additions & 0 deletions databox/api/src/Api/Model/Output/ThreadMessageOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Api\Model\Output;

use ApiPlatform\Metadata\ApiProperty;
use App\Api\Model\Output\Traits\CreatedAtDTOTrait;
use App\Api\Model\Output\Traits\UpdatedAtDTOTrait;
use App\Entity\Discussion\Message;
Expand All @@ -26,4 +27,14 @@ class ThreadMessageOutput extends AbstractUuidOutput

#[Groups([Message::GROUP_LIST, Message::GROUP_READ])]
public ?array $attachments = null;

#[ApiProperty(jsonSchemaContext: [
'type' => 'object',
'properties' => [
'canEdit' => 'boolean',
'canDelete' => 'boolean',
],
])]
#[Groups([Message::GROUP_LIST, Message::GROUP_READ])]
public array $capabilities = [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Api\Model\Output\ThreadMessageOutput;
use App\Api\Traits\UserLocaleTrait;
use App\Entity\Discussion\Message;
use App\Security\Voter\AbstractVoter;
use Doctrine\ORM\EntityManagerInterface;

class ThreadMessageOutputTransformer implements OutputTransformerInterface
Expand Down Expand Up @@ -46,6 +47,10 @@ public function transform(object $data, string $outputClass, array &$context = [
Message::GROUP_READ,
], $context)) {
$output->author = $this->transformUser($data->getAuthorId());
$output->capabilities = [
'canEdit' => $this->isGranted(AbstractVoter::EDIT, $data),
'canDelete' => $this->isGranted(AbstractVoter::DELETE, $data),
];
}

return $output;
Expand Down
4 changes: 2 additions & 2 deletions databox/api/src/Api/Processor/PostMessageProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public function process($data, Operation $operation, array $uriVariables = [], a
$this->em->flush();

$this->bus->dispatch($this->pusherManager->createBusMessage(
'thread-' . $thread->getId(),
'thread-'.$thread->getId(),
'message',
json_decode($this->serializer->serialize($message, 'json', [
'groups' => [
'_',
Message::GROUP_READ,
]
],
]), true, 512, JSON_THROW_ON_ERROR),
));

Expand Down
1 change: 0 additions & 1 deletion databox/api/src/Api/Provider/ThreadMessagesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use ApiPlatform\State\ProviderInterface;
use App\Api\Traits\CollectionProviderAwareTrait;
use App\Entity\Discussion\Thread;
use App\Entity\Integration\WorkspaceIntegration;
use App\Security\Voter\AbstractVoter;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
Expand Down
8 changes: 3 additions & 5 deletions databox/api/src/Command/DocumentationDumperCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,24 @@

namespace App\Command;

use Alchemy\RenditionFactory\RenditionBuilderConfigurationDocumentation;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Alchemy\RenditionFactory\RenditionBuilderConfigurationDocumentation;


#[AsCommand('app:documentation:dump')]
class DocumentationDumperCommand extends Command
{
public function __construct(
private readonly RenditionBuilderConfigurationDocumentation $renditionBuilderConfigurationDocumentation,
)
{
) {
parent::__construct();
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln('# ' . $this->renditionBuilderConfigurationDocumentation::getName());
$output->writeln('# '.$this->renditionBuilderConfigurationDocumentation::getName());
$output->writeln($this->renditionBuilderConfigurationDocumentation->generate());

return Command::SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use EasyCorp\Bundle\EasyAdminBundle\Filter\ChoiceFilter;
use EasyCorp\Bundle\EasyAdminBundle\Filter\DateTimeFilter;
use EasyCorp\Bundle\EasyAdminBundle\Filter\NumericFilter;
use EasyCorp\Bundle\EasyAdminBundle\Filter\TextFilter;
use Symfony\Component\HttpFoundation\RedirectResponse;

class JobStateCrudController extends AbstractAdminCrudController
Expand Down
2 changes: 0 additions & 2 deletions databox/api/src/Doctrine/Listener/FileListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace App\Doctrine\Listener;

use Alchemy\MessengerBundle\Listener\PostFlushStack;
use App\Consumer\Handler\File\DeleteFileFromStorage;
use App\Consumer\Handler\File\DeleteFilesIfOrphan;
use App\Entity\Core\Asset;
use App\Entity\Core\AssetFileVersion;
Expand Down Expand Up @@ -46,7 +45,6 @@ private function addFileToDelete(?File $file): void
$this->postFlushStack->addBusMessage(new DeleteFilesIfOrphan([$file->getId()]));
}


public function getSubscribedEvents(): array
{
return [
Expand Down
3 changes: 1 addition & 2 deletions databox/api/src/Elasticsearch/ESDocumentStateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Elastica\Request;
use FOS\ElasticaBundle\Persister\ObjectPersister;
use FOS\ElasticaBundle\Persister\ObjectPersisterInterface;
use RuntimeException;
use Symfony\Component\DependencyInjection\Attribute\TaggedIterator;

final readonly class ESDocumentStateManager
Expand Down Expand Up @@ -43,6 +42,6 @@ private function getObjectPersister(object $object): ObjectPersister
}
}

throw new RuntimeException(sprintf('No object persister found for object of class %s', get_class($object)));
throw new \RuntimeException(sprintf('No object persister found for object of class %s', get_class($object)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@

namespace App\Elasticsearch\Listener;

use App\Asset\Attribute\AttributesResolver;
use App\Attribute\AttributeInterface;
use App\Attribute\AttributeTypeRegistry;
use App\Elasticsearch\AssetPermissionComputer;
use App\Elasticsearch\Mapping\FieldNameResolver;
use App\Entity\Core\Asset;
use App\Entity\Core\AssetRendition;
use App\Entity\Core\Attribute;
use App\Entity\Core\RenditionDefinition;
use App\Entity\Discussion\Message;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query\Expr\Join;
use FOS\ElasticaBundle\Event\PostTransformEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

Expand Down
4 changes: 2 additions & 2 deletions databox/api/src/Entity/Basket/Basket.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Alchemy\AclBundle\AclObjectInterface;
use Alchemy\AuthBundle\Security\JwtUser;
use Alchemy\CoreBundle\Entity\AbstractUuidEntity;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use Alchemy\ESBundle\Indexer\ESIndexableInterface;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
Expand All @@ -21,9 +23,7 @@
use App\Api\Processor\AddToBasketProcessor;
use App\Api\Processor\RemoveFromBasketProcessor;
use App\Api\Provider\BasketCollectionProvider;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use App\Entity\Traits\OwnerIdTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use App\Entity\WithOwnerIdInterface;
use App\Repository\Basket\BasketRepository;
use App\Security\Voter\AbstractVoter;
Expand Down
2 changes: 1 addition & 1 deletion databox/api/src/Entity/Basket/BasketAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
namespace App\Entity\Basket;

use Alchemy\CoreBundle\Entity\AbstractUuidEntity;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Link;
use App\Api\Provider\BasketAssetCollectionProvider;
use App\Entity\Core\Asset;
use App\Entity\Traits\AssetAnnotationsTrait;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use App\Entity\Traits\OwnerIdTrait;
use App\Entity\WithOwnerIdInterface;
use Doctrine\DBAL\Types\Types;
Expand Down
6 changes: 3 additions & 3 deletions databox/api/src/Entity/Core/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Alchemy\AclBundle\AclObjectInterface;
use Alchemy\AuthBundle\Security\JwtUser;
use Alchemy\CoreBundle\Entity\AbstractUuidEntity;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use Alchemy\ESBundle\Indexer\ESIndexableDependencyInterface;
use Alchemy\ESBundle\Indexer\ESIndexableInterface;
use ApiPlatform\Metadata\ApiResource;
Expand All @@ -28,8 +30,8 @@
use App\Api\Model\Output\MultipleAssetOutput;
use App\Api\Model\Output\PrepareDeleteAssetsOutput;
use App\Api\Processor\AssetAttributeBatchUpdateProcessor;
use App\Api\Processor\ItemElasticsearchDocumentSyncProcessor;
use App\Api\Processor\CopyAssetProcessor;
use App\Api\Processor\ItemElasticsearchDocumentSyncProcessor;
use App\Api\Processor\MoveAssetProcessor;
use App\Api\Processor\MultipleAssetCreateProcessor;
use App\Api\Processor\PrepareDeleteAssetProcessor;
Expand All @@ -41,11 +43,9 @@
use App\Api\Provider\SearchSuggestionCollectionProvider;
use App\Controller\Core\DeleteAssetByIdsAction;
use App\Controller\Core\DeleteAssetByKeysAction;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use App\Entity\ObjectTitleInterface;
use App\Entity\Traits\LocaleTrait;
use App\Entity\Traits\OwnerIdTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use App\Entity\Traits\WorkspacePrivacyTrait;
use App\Entity\Traits\WorkspaceTrait;
use App\Entity\TranslatableInterface;
Expand Down
4 changes: 2 additions & 2 deletions databox/api/src/Entity/Core/AssetFileVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
namespace App\Entity\Core;

use Alchemy\CoreBundle\Entity\AbstractUuidEntity;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;

use ApiPlatform\Metadata\GetCollection;
use App\Api\Provider\AssetFileVersionCollectionProvider;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
Expand Down
2 changes: 1 addition & 1 deletion databox/api/src/Entity/Core/AssetRelationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
namespace App\Entity\Core;

use Alchemy\CoreBundle\Entity\AbstractUuidEntity;
use App\Entity\Integration\WorkspaceIntegration;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use App\Entity\Integration\WorkspaceIntegration;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;

Expand Down
5 changes: 2 additions & 3 deletions databox/api/src/Entity/Core/AssetRendition.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
namespace App\Entity\Core;

use Alchemy\CoreBundle\Entity\AbstractUuidEntity;
use ApiPlatform\Metadata\ApiProperty;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Get;
Expand All @@ -16,8 +17,6 @@
use App\Api\Model\Input\AssetRenditionInput;
use App\Api\Model\Output\AssetRenditionOutput;
use App\Api\Provider\RenditionCollectionProvider;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use App\Repository\Core\AssetRenditionRepository;
use App\Security\Voter\AbstractVoter;
use Doctrine\DBAL\Types\Types;
Expand Down
2 changes: 1 addition & 1 deletion databox/api/src/Entity/Core/AttributeClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Alchemy\AclBundle\AclObjectInterface;
use Alchemy\AuthBundle\Security\JwtUser;
use Alchemy\CoreBundle\Entity\AbstractUuidEntity;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Get;
Expand All @@ -16,7 +17,6 @@
use ApiPlatform\Metadata\Put;
use App\Api\Model\Input\AttributeClassInput;
use App\Api\Provider\AttributeClassCollectionProvider;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use App\Entity\Traits\WorkspaceTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection as DoctrineCollection;
Expand Down
4 changes: 2 additions & 2 deletions databox/api/src/Entity/Core/AttributeDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use Alchemy\AuthBundle\Security\JwtUser;
use Alchemy\CoreBundle\Entity\AbstractUuidEntity;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
Expand All @@ -20,8 +22,6 @@
use App\Attribute\AttributeInterface;
use App\Attribute\Type\TextAttributeType;
use App\Controller\Core\AttributeDefinitionSortAction;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use App\Entity\Traits\WorkspaceTrait;
use App\Repository\Core\AttributeDefinitionRepository;
use Doctrine\Common\Collections\Collection as DoctrineCollection;
Expand Down
4 changes: 2 additions & 2 deletions databox/api/src/Entity/Core/AttributeEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace App\Entity\Core;

use Alchemy\CoreBundle\Entity\AbstractUuidEntity;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\ApiResource;
Expand All @@ -15,8 +17,6 @@
use ApiPlatform\Metadata\Post;
use ApiPlatform\Metadata\Put;
use App\Api\Provider\AttributeEntityCollectionProvider;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use App\Entity\Traits\WorkspaceTrait;
use App\Repository\Core\AttributeEntityRepository;
use Doctrine\DBAL\Types\Types;
Expand Down
4 changes: 2 additions & 2 deletions databox/api/src/Entity/Core/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use Alchemy\AclBundle\AclObjectInterface;
use Alchemy\CoreBundle\Entity\AbstractUuidEntity;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use Alchemy\ESBundle\Indexer\ESIndexableDeleteDependencyInterface;
use Alchemy\ESBundle\Indexer\ESIndexableDependencyInterface;
use Alchemy\ESBundle\Indexer\ESIndexableInterface;
Expand All @@ -25,12 +27,10 @@
use App\Api\Provider\CollectionProvider;
use App\Api\Provider\ItemElasticsearchDocumentProvider;
use App\Doctrine\Listener\SoftDeleteableInterface;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use App\Entity\ObjectTitleInterface;
use App\Entity\Traits\DeletedAtTrait;
use App\Entity\Traits\LocaleTrait;
use App\Entity\Traits\OwnerIdTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use App\Entity\Traits\WorkspacePrivacyTrait;
use App\Entity\Traits\WorkspaceTrait;
use App\Entity\TranslatableInterface;
Expand Down
2 changes: 1 addition & 1 deletion databox/api/src/Entity/Core/CollectionAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
namespace App\Entity\Core;

use Alchemy\CoreBundle\Entity\AbstractUuidEntity;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Alchemy\ESBundle\Indexer\ESIndexableDeleteDependencyInterface;
use Alchemy\ESBundle\Indexer\ESIndexableDependencyInterface;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Post;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use App\Repository\Core\CollectionAssetRepository;
use Doctrine\ORM\Mapping as ORM;

Expand Down
4 changes: 2 additions & 2 deletions databox/api/src/Entity/Core/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
namespace App\Entity\Core;

use Alchemy\CoreBundle\Entity\AbstractUuidEntity;
use ApiPlatform\Metadata\ApiResource;
use App\Api\Model\Output\FileOutput;
use Alchemy\CoreBundle\Entity\Traits\CreatedAtTrait;
use Alchemy\CoreBundle\Entity\Traits\UpdatedAtTrait;
use ApiPlatform\Metadata\ApiResource;
use App\Api\Model\Output\FileOutput;
use App\Entity\Traits\WorkspaceTrait;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
Expand Down
Loading

0 comments on commit dfad205

Please sign in to comment.