fix parameter order
Signed-off-by: dartcafe <github@dartcafe.de>
This commit is contained in:
Родитель
f4f01c7bd3
Коммит
4e71bdb14f
|
@ -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 {
|
||||
|
|
Загрузка…
Ссылка в новой задаче