mirror of
https://github.com/flarum/framework.git
synced 2024-11-26 02:10:09 +08:00
Replace depreciated helper function with classfull one
This commit is contained in:
parent
df3e1843cc
commit
e6734ab62a
|
@ -10,6 +10,7 @@
|
||||||
namespace Flarum\Pusher\Api\Controller;
|
namespace Flarum\Pusher\Api\Controller;
|
||||||
|
|
||||||
use Flarum\Settings\SettingsRepositoryInterface;
|
use Flarum\Settings\SettingsRepositoryInterface;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
use Laminas\Diactoros\Response\EmptyResponse;
|
use Laminas\Diactoros\Response\EmptyResponse;
|
||||||
use Laminas\Diactoros\Response\JsonResponse;
|
use Laminas\Diactoros\Response\JsonResponse;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
@ -41,7 +42,7 @@ class AuthController implements RequestHandlerInterface
|
||||||
$userChannel = 'private-user'.$request->getAttribute('actor')->id;
|
$userChannel = 'private-user'.$request->getAttribute('actor')->id;
|
||||||
$body = $request->getParsedBody();
|
$body = $request->getParsedBody();
|
||||||
|
|
||||||
if (array_get($body, 'channel_name') === $userChannel) {
|
if (Arr::get($body, 'channel_name') === $userChannel) {
|
||||||
$pusher = new Pusher(
|
$pusher = new Pusher(
|
||||||
$this->settings->get('flarum-pusher.app_key'),
|
$this->settings->get('flarum-pusher.app_key'),
|
||||||
$this->settings->get('flarum-pusher.app_secret'),
|
$this->settings->get('flarum-pusher.app_secret'),
|
||||||
|
@ -49,7 +50,7 @@ class AuthController implements RequestHandlerInterface
|
||||||
['cluster' => $this->settings->get('flarum-pusher.app_cluster')]
|
['cluster' => $this->settings->get('flarum-pusher.app_cluster')]
|
||||||
);
|
);
|
||||||
|
|
||||||
$payload = json_decode($pusher->socket_auth($userChannel, array_get($body, 'socket_id')), true);
|
$payload = json_decode($pusher->socket_auth($userChannel, Arr::get($body, 'socket_id')), true);
|
||||||
|
|
||||||
return new JsonResponse($payload);
|
return new JsonResponse($payload);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user