From 8106e1b488c2243746ec5d39700bbbab1f7a250a Mon Sep 17 00:00:00 2001 From: dartcafe Date: Tue, 1 Sep 2020 00:09:19 +0200 Subject: some fixes --- lib/Controller/PollApiController.php | 2 +- lib/Controller/ShareApiController.php | 2 +- lib/Controller/SubscriptionApiController.php | 6 +++--- lib/Model/Acl.php | 2 +- lib/Service/PollService.php | 2 +- lib/Service/VoteService.php | 5 +++-- 6 files changed, 10 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/Controller/PollApiController.php b/lib/Controller/PollApiController.php index c2e4750f..c9cdc174 100644 --- a/lib/Controller/PollApiController.php +++ b/lib/Controller/PollApiController.php @@ -90,7 +90,7 @@ */ public function get($pollId) { try { - return new DataResponse(['poll' => $this->pollService->get($pollId)], Http::STATUS_OK); + return new DataResponse(['poll' => $this->pollService->get($pollId, '')], Http::STATUS_OK); } catch (DoesNotExistException $e) { return new DataResponse(['error' => 'Not found'], Http::STATUS_NOT_FOUND); } catch (NotAuthorizedException $e) { diff --git a/lib/Controller/ShareApiController.php b/lib/Controller/ShareApiController.php index 57c65033..5ffe1a63 100644 --- a/lib/Controller/ShareApiController.php +++ b/lib/Controller/ShareApiController.php @@ -76,7 +76,7 @@ class ShareApiController extends ApiController { */ public function list($pollId) { try { - return new DataResponse(['shares' => $this->shareService->list($pollId)], Http::STATUS_OK); + return new DataResponse(['shares' => $this->shareService->list($pollId, '')], Http::STATUS_OK); } catch (DoesNotExistException $e) { return new DataResponse(['error' => 'No shares for poll with id ' . $pollId . ' not found'], Http::STATUS_NOT_FOUND); } catch (NotAuthorizedException $e) { diff --git a/lib/Controller/SubscriptionApiController.php b/lib/Controller/SubscriptionApiController.php index b8a87d16..84936691 100644 --- a/lib/Controller/SubscriptionApiController.php +++ b/lib/Controller/SubscriptionApiController.php @@ -73,7 +73,7 @@ class SubscriptionApiController extends ApiController { */ public function get($pollId) { try { - $this->subscriptionService->get($pollId); + $this->subscriptionService->get($pollId, ''); return new DataResponse(['status' => 'Subscribed to poll ' . $pollId], Http::STATUS_OK); } catch (DoesNotExistException $e) { return new DataResponse(['status' => 'Not subscribed to poll ' . $pollId], Http::STATUS_NOT_FOUND); @@ -92,7 +92,7 @@ class SubscriptionApiController extends ApiController { */ public function subscribe($pollId) { try { - $this->subscriptionService->set($pollId, true); + $this->subscriptionService->set($pollId, '', true); return new DataResponse(['status' => 'Subscribed to poll ' . $pollId], Http::STATUS_OK); } catch (NotAuthorizedException $e) { return new DataResponse(['error' => $e->getMessage()], $e->getStatus()); @@ -108,7 +108,7 @@ class SubscriptionApiController extends ApiController { */ public function unsubscribe($pollId) { try { - $this->subscriptionService->set($pollId, false); + $this->subscriptionService->set($pollId, '', false); return new DataResponse(['status' => 'Unsubscribed from poll ' . $pollId], Http::STATUS_OK); } catch (NotAuthorizedException $e) { return new DataResponse(['error' => $e->getMessage()], $e->getStatus()); diff --git a/lib/Model/Acl.php b/lib/Model/Acl.php index 86743c67..b68386f0 100644 --- a/lib/Model/Acl.php +++ b/lib/Model/Acl.php @@ -141,7 +141,7 @@ class Acl implements JsonSerializable { $this->pollId = $this->share->getPollId(); } elseif ($pollId) { - $this->user = \OC::$server->getUserSession()->getUser()->getUID(); + $this->userId = \OC::$server->getUserSession()->getUser()->getUID(); $this->pollId = $pollId; $this->share = null; } diff --git a/lib/Service/PollService.php b/lib/Service/PollService.php index b9fdbdef..f694853a 100644 --- a/lib/Service/PollService.php +++ b/lib/Service/PollService.php @@ -313,7 +313,7 @@ class PollService { * Collect email addresses from particitipants * @NoAdminRequired * @param Array $poll - * @return DataResponse + * @return array */ public function getParticipantsEmailAddresses($pollId) { diff --git a/lib/Service/VoteService.php b/lib/Service/VoteService.php index cbedb1ad..26f70502 100644 --- a/lib/Service/VoteService.php +++ b/lib/Service/VoteService.php @@ -151,7 +151,7 @@ class VoteService { * @param int $voteId * @param string $userId * @param int $pollId - * @return Vote + * @return boolean * @throws NotAuthorizedException */ public function delete($pollId, $userId) { @@ -160,7 +160,8 @@ class VoteService { throw new NotAuthorizedException; } - $votes = $this->voteMapper->deleteByPollAndUser($pollId, $userId); + $this->voteMapper->deleteByPollAndUser($pollId, $userId); + return true; } } -- cgit v1.2.3