Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/Modules/Demeter/Infrastructure/Controller/Forum/CloseTopic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

namespace App\Modules\Demeter\Infrastructure\Controller\Forum;

use App\Modules\Demeter\Domain\Repository\Forum\ForumTopicRepositoryInterface;
use App\Modules\Zeus\Model\Player;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Uid\Uuid;

class CloseTopic extends AbstractController
{
public function __invoke(
ForumTopicRepositoryInterface $forumTopicRepository,
Player $currentPlayer,
int $forumId,
Uuid $topicId,
): Response {
$topic = $forumTopicRepository->get($topicId)
?? throw $this->createNotFoundException('Topic not found');

if ($currentPlayer->status <= 2) {
throw $this->createAccessDeniedException('You cannot close or open a topic');
}

$topic->isClosed = !$topic->isClosed;

$forumTopicRepository->save($topic);

$this->addFlash('success', 'Le sujet a bien été fermé/ouvert');

return $this->redirectToRoute('view_forum_topic', [
'forumId' => $forumId,
'topicId' => $topicId,
]);
}
}
27 changes: 0 additions & 27 deletions src/action/std/demeter/donate.php

This file was deleted.

47 changes: 0 additions & 47 deletions src/action/std/demeter/message/edit.php

This file was deleted.

73 changes: 0 additions & 73 deletions src/action/std/demeter/message/write.php

This file was deleted.

36 changes: 0 additions & 36 deletions src/action/std/demeter/topic/close.php

This file was deleted.

65 changes: 0 additions & 65 deletions src/action/std/demeter/topic/createTopic.php

This file was deleted.

40 changes: 0 additions & 40 deletions src/action/std/hermes/radio/write.php

This file was deleted.

43 changes: 0 additions & 43 deletions src/action/std/hermes/roadmap/write.php

This file was deleted.