From 810d314820dd5f8a478fd1dd021ddafe02c53101 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 20 Dec 2024 11:39:47 +0100 Subject: [PATCH] fixup! fixup! feat(polls): allow editing of draft polls --- .../Proxy/TalkV1/Controller/PollController.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/Federation/Proxy/TalkV1/Controller/PollController.php b/lib/Federation/Proxy/TalkV1/Controller/PollController.php index 5e4b53e92bc..cf7c2f9675b 100644 --- a/lib/Federation/Proxy/TalkV1/Controller/PollController.php +++ b/lib/Federation/Proxy/TalkV1/Controller/PollController.php @@ -18,6 +18,7 @@ use OCA\Talk\Room; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; +use Psr\Log\LoggerInterface; /** * @psalm-import-type TalkPoll from ResponseDefinitions @@ -27,6 +28,7 @@ class PollController { public function __construct( protected ProxyRequest $proxy, protected UserConverter $userConverter, + protected LoggerInterface $logger, ) { } @@ -132,7 +134,7 @@ public function votePoll(Room $room, Participant $participant, int $pollId, arra /** - * @return DataResponse|DataResponse|DataResponse + * @return DataResponse|DataResponse|DataResponse * @throws CannotReachRemoteException * * 200: Draft created successfully @@ -172,7 +174,7 @@ public function createPoll(Room $room, Participant $participant, string $questio } /** - * @return DataResponse|DataResponse|DataResponse + * @return DataResponse|DataResponse * @throws CannotReachRemoteException * * 200: Draft created successfully @@ -211,7 +213,7 @@ public function updateDraftPoll(int $pollId, Room $room, Participant $participan } /** - * @return DataResponse|DataResponse|DataResponse + * @return DataResponse|DataResponse|DataResponse * @throws CannotReachRemoteException * * 200: Poll closed successfully @@ -239,7 +241,12 @@ public function closePoll(Room $room, Participant $participant, int $pollId): Da } /** @var array{error?: string} $data */ $data = $this->proxy->getOCSData($proxy); - return new DataResponse(['error' => $data['error'] ?? PollPropertyException::REASON_POLL], $statusCode); + + if ($data['error'] !== PollPropertyException::REASON_POLL) { + $this->logger->error('Unhandled error in ' . __METHOD__ . ': ' . $data['error']); + } + + return new DataResponse(['error' => PollPropertyException::REASON_POLL], $statusCode); } /** @var TalkPoll $data */