diff options
author | Joas Schilling <coding@schilljs.com> | 2023-04-24 16:17:11 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-04-25 12:12:19 +0200 |
commit | f39a4299ab8334247b50f0cd42c7e24fe4e184f7 (patch) | |
tree | 52252411a28895247c07f9b9b5289679f0f9897c /lib/Controller/PollController.php | |
parent | b2b0bdfba9635ffea0e46b689f5a6f417ae23172 (diff) |
techdebt(controllers): Migrate Talk annotations to attributes
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Controller/PollController.php')
-rw-r--r-- | lib/Controller/PollController.php | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/lib/Controller/PollController.php b/lib/Controller/PollController.php index 11e243e14..b3ff27d2c 100644 --- a/lib/Controller/PollController.php +++ b/lib/Controller/PollController.php @@ -28,6 +28,10 @@ namespace OCA\Talk\Controller; use OCA\Talk\Chat\ChatManager; use OCA\Talk\Exceptions\WrongPermissionsException; +use OCA\Talk\Middleware\Attribute\RequireModeratorOrNoLobby; +use OCA\Talk\Middleware\Attribute\RequireParticipant; +use OCA\Talk\Middleware\Attribute\RequirePermission; +use OCA\Talk\Middleware\Attribute\RequireReadWriteConversation; use OCA\Talk\Model\Poll; use OCA\Talk\Model\Vote; use OCA\Talk\Room; @@ -67,17 +71,11 @@ class PollController extends AEnvironmentAwareController { /** * @PublicPage - * @RequireParticipant - * @RequireReadWriteConversation - * @RequirePermissions(permissions=chat) - * @RequireModeratorOrNoLobby - * - * @param string $question - * @param array $options - * @param int $resultMode - * @param int $maxVotes - * @return DataResponse */ + #[RequireModeratorOrNoLobby] + #[RequireParticipant] + #[RequirePermission(permission: RequirePermission::CHAT)] + #[RequireReadWriteConversation] public function createPoll(string $question, array $options, int $resultMode, int $maxVotes): DataResponse { if ($this->room->getType() !== Room::TYPE_GROUP && $this->room->getType() !== Room::TYPE_PUBLIC) { @@ -125,12 +123,9 @@ class PollController extends AEnvironmentAwareController { /** * @PublicPage - * @RequireParticipant - * @RequireModeratorOrNoLobby - * - * @param int $pollId - * @return DataResponse */ + #[RequireModeratorOrNoLobby] + #[RequireParticipant] public function showPoll(int $pollId): DataResponse { try { $poll = $this->pollService->getPoll($this->room->getId(), $pollId); @@ -149,13 +144,13 @@ class PollController extends AEnvironmentAwareController { /** * @PublicPage - * @RequireParticipant - * @RequireModeratorOrNoLobby * * @param int $pollId * @param int[] $optionIds * @return DataResponse */ + #[RequireModeratorOrNoLobby] + #[RequireParticipant] public function votePoll(int $pollId, array $optionIds = []): DataResponse { try { $poll = $this->pollService->getPoll($this->room->getId(), $pollId); @@ -197,12 +192,9 @@ class PollController extends AEnvironmentAwareController { /** * @PublicPage - * @RequireParticipant - * @RequireModeratorOrNoLobby - * - * @param int $pollId - * @return DataResponse */ + #[RequireModeratorOrNoLobby] + #[RequireParticipant] public function closePoll(int $pollId): DataResponse { try { $poll = $this->pollService->getPoll($this->room->getId(), $pollId); |