From f0a9b5245de8d1c1bf55d17631f8d8e44a547ffd Mon Sep 17 00:00:00 2001 From: dartcafe Date: Fri, 19 Sep 2025 23:41:11 +0200 Subject: [PATCH] revome deleted limitation on get poll Signed-off-by: dartcafe --- lib/Db/PollMapper.php | 6 +----- lib/Helper/Container.php | 4 ++-- lib/Service/CommentService.php | 2 +- lib/Service/OptionService.php | 2 +- lib/Service/SubscriptionService.php | 2 +- lib/Service/VoteService.php | 2 +- lib/Service/WatchService.php | 2 +- 7 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/Db/PollMapper.php b/lib/Db/PollMapper.php index 0fbcbdce32..8286ed0a7c 100644 --- a/lib/Db/PollMapper.php +++ b/lib/Db/PollMapper.php @@ -37,14 +37,10 @@ public function __construct( * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result * @return Poll */ - public function get(int $id, bool $getDeleted = false): Poll { + public function get(int $id): Poll { $qb = $this->buildQuery(); $qb->where($qb->expr()->eq(self::TABLE . '.id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT))); - if (!$getDeleted) { - $qb->andWhere($qb->expr()->eq(self::TABLE . '.deleted', $qb->expr()->literal(0, IQueryBuilder::PARAM_INT))); - } - return $this->findEntity($qb); } diff --git a/lib/Helper/Container.php b/lib/Helper/Container.php index 43528876a8..77c71749ca 100644 --- a/lib/Helper/Container.php +++ b/lib/Helper/Container.php @@ -33,8 +33,8 @@ public static function logger(): LoggerInterface { return Server::get(LoggerInterface::class); } - public static function getPoll(int $pollId, bool $getDeleted = false): Poll { - return Server::get(PollMapper::class)->get($pollId, $getDeleted); + public static function getPoll(int $pollId): Poll { + return Server::get(PollMapper::class)->get($pollId); } public static function queryPoll(int $pollId): Poll { diff --git a/lib/Service/CommentService.php b/lib/Service/CommentService.php index 1ea7320fcb..cf7818fe8b 100644 --- a/lib/Service/CommentService.php +++ b/lib/Service/CommentService.php @@ -36,7 +36,7 @@ public function __construct( */ public function list(int $pollId): array { try { - $this->pollMapper->get($pollId, true) + $this->pollMapper->get($pollId) ->request(Poll::PERMISSION_COMMENT_ADD); } catch (Exception $e) { return []; diff --git a/lib/Service/OptionService.php b/lib/Service/OptionService.php index 184d70b009..330056d0ae 100644 --- a/lib/Service/OptionService.php +++ b/lib/Service/OptionService.php @@ -444,7 +444,7 @@ private function moveModifier(int $moveFrom, int $moveTo, int $currentPosition): */ private function getPoll(int $pollId, string $permission = Poll::PERMISSION_POLL_ACCESS): void { if ($this->poll->getId() !== $pollId) { - $this->poll = $this->pollMapper->get($pollId, true); + $this->poll = $this->pollMapper->get($pollId); } $this->poll->request($permission); } diff --git a/lib/Service/SubscriptionService.php b/lib/Service/SubscriptionService.php index b6e93f7296..4d0665ddd6 100644 --- a/lib/Service/SubscriptionService.php +++ b/lib/Service/SubscriptionService.php @@ -27,7 +27,7 @@ public function __construct( } public function get(int $pollId): bool { - $this->pollMapper->get($pollId, true)->request(Poll::PERMISSION_POLL_ACCESS); + $this->pollMapper->get($pollId)->request(Poll::PERMISSION_POLL_ACCESS); try { $this->subscriptionMapper->findByPollAndUser($pollId, $this->userSession->getCurrentUserId()); diff --git a/lib/Service/VoteService.php b/lib/Service/VoteService.php index 35c7069395..94cac01b51 100644 --- a/lib/Service/VoteService.php +++ b/lib/Service/VoteService.php @@ -40,7 +40,7 @@ public function __construct( * @return Vote[] */ public function list(int $pollId): array { - $poll = $this->pollMapper->get($pollId, true) + $poll = $this->pollMapper->get($pollId) ->request(Poll::PERMISSION_POLL_ACCESS); try { diff --git a/lib/Service/WatchService.php b/lib/Service/WatchService.php index bb8bc8272c..0d07493eaa 100644 --- a/lib/Service/WatchService.php +++ b/lib/Service/WatchService.php @@ -36,7 +36,7 @@ public function __construct( */ public function watchUpdates(int $pollId, string $mode, ?int $offset = null): array { if ($pollId) { - $this->pollMapper->get($pollId, true) + $this->pollMapper->get($pollId) ->request(Poll::PERMISSION_POLL_ACCESS); }