diff --git a/lib/Controller/PublicController.php b/lib/Controller/PublicController.php index 5843d7a2d..040f4eb18 100644 --- a/lib/Controller/PublicController.php +++ b/lib/Controller/PublicController.php @@ -293,7 +293,7 @@ class PublicController extends Controller { */ public function subscribe(string $token): DataResponse { return $this->response(function () use ($token) { - return ['subscribed' => $this->subscriptionService->set(0, $token, true)]; + return ['subscribed' => $this->subscriptionService->set(true, 0, $token)]; }); } @@ -304,7 +304,7 @@ class PublicController extends Controller { */ public function unsubscribe(string $token): DataResponse { return $this->response(function () use ($token) { - return ['subscribed' => $this->subscriptionService->set(0, $token, false)]; + return ['subscribed' => $this->subscriptionService->set(true, 0, $token)]; }); } diff --git a/lib/Controller/SubscriptionApiController.php b/lib/Controller/SubscriptionApiController.php index 7a63e88eb..419d2228d 100644 --- a/lib/Controller/SubscriptionApiController.php +++ b/lib/Controller/SubscriptionApiController.php @@ -78,7 +78,7 @@ class SubscriptionApiController extends ApiController { */ public function subscribe(int $pollId): DataResponse { try { - $this->subscriptionService->set($pollId, '', true); + $this->subscriptionService->set(true, $pollId, ''); return new DataResponse(['status' => 'Subscribed to poll ' . $pollId], Http::STATUS_OK); } catch (Exception $e) { return new DataResponse(['message' => $e->getMessage()], $e->getStatus()); @@ -93,7 +93,7 @@ class SubscriptionApiController extends ApiController { */ public function unsubscribe(int $pollId): DataResponse { try { - $this->subscriptionService->set($pollId, '', false); + $this->subscriptionService->set(false, $pollId, ''); return new DataResponse(['status' => 'Unsubscribed from poll ' . $pollId], Http::STATUS_OK); } catch (Exception $e) { return new DataResponse(['message' => $e->getMessage()], $e->getStatus()); diff --git a/lib/Controller/SubscriptionController.php b/lib/Controller/SubscriptionController.php index deb640e14..b6289c468 100644 --- a/lib/Controller/SubscriptionController.php +++ b/lib/Controller/SubscriptionController.php @@ -61,7 +61,7 @@ class SubscriptionController extends Controller { */ public function subscribe(int $pollId): DataResponse { return $this->response(function () use ($pollId) { - return ['subscribed' => $this->subscriptionService->set($pollId, '', true)]; + return ['subscribed' => $this->subscriptionService->set(true, $pollId, '')]; }); } @@ -71,7 +71,7 @@ class SubscriptionController extends Controller { */ public function unsubscribe(int $pollId): DataResponse { return $this->response(function () use ($pollId) { - return ['subscribed' => $this->subscriptionService->set($pollId, '', false)]; + return ['subscribed' => $this->subscriptionService->set(false, $pollId, '')]; }); } } diff --git a/lib/Service/SubscriptionService.php b/lib/Service/SubscriptionService.php index fa35ea5a5..558be8fe2 100644 --- a/lib/Service/SubscriptionService.php +++ b/lib/Service/SubscriptionService.php @@ -69,7 +69,7 @@ class SubscriptionService { $this->subscriptionMapper->insert($subscription); } - public function set(int $pollId = 0, string $token = '', bool $subscribed): bool { + public function set(bool $subscribed, int $pollId = 0, string $token = ''): bool { if ($token) { $this->acl->setToken($token); } else {