Signed-off-by: dartcafe <github@dartcafe.de>
This commit is contained in:
dartcafe 2021-07-05 12:15:24 +02:00
Родитель f4f01c7bd3
Коммит 4e71bdb14f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CCE73CEF3035D3C8
4 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -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)];
});
}

Просмотреть файл

@ -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());

Просмотреть файл

@ -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, '')];
});
}
}

Просмотреть файл

@ -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 {