Skip to content

Commit

Permalink
Merge pull request #5 from KyrneDev/analysis-1b7K4v
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
KyrneDev committed Aug 21, 2021
2 parents ed6945b + 91baa6e commit 41f454a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
3 changes: 1 addition & 2 deletions BeyondCode/src/Server/Messages/PusherMessageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public static function createForMessage(
MessageInterface $message,
ConnectionInterface $connection,
ChannelManager $channelManager
): PusherMessage
{
): PusherMessage {
$payload = json_decode($message->getPayload());

return Str::startsWith($payload->event, 'pusher:')
Expand Down
4 changes: 2 additions & 2 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@

(new Frontend('forum'))
->js(__DIR__.'/js/dist/forum.js')
->css(__DIR__ . '/resources/less/forum.less'),
->css(__DIR__.'/resources/less/forum.less'),

(new Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js')
->css(__DIR__ . '/resources/less/admin.less')
->css(__DIR__.'/resources/less/admin.less')
->content(AddStatsData::class),

new Locales(__DIR__.'/resources/locale'),
Expand Down
8 changes: 3 additions & 5 deletions src/Api/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(SettingsRepositoryInterface $settings, SlugManager $
public function handle(ServerRequestInterface $request): ResponseInterface
{
$actor = RequestUtil::getActor($request);
$userChannel = 'private-user' . $actor->id;
$userChannel = 'private-user'.$actor->id;
$body = $request->getParsedBody();
$channelName = Arr::get($body, 'channel_name');
$socketId = Arr::get($body, 'socket_id');
Expand Down Expand Up @@ -76,14 +76,12 @@ public function handle(ServerRequestInterface $request): ResponseInterface
} else {
$payload = json_decode($pusher->presence_auth($channelName, $socketId, $actor->id, [
'displayName' => $actor->getDisplayNameAttribute(),
'avatarUrl' => $actor->avatar_url,
'slug' => $this->slugManager->forResource(User::class)->toSlug($actor),
'avatarUrl' => $actor->avatar_url,
'slug' => $this->slugManager->forResource(User::class)->toSlug($actor),
]), true);
}

return new JsonResponse($payload);


} elseif (strpos($channelName, 'private-loginId') !== false) {
$pusher = new Pusher(
$this->settings->get('kyrne-websocket.app_key'),
Expand Down
9 changes: 4 additions & 5 deletions src/Api/Controllers/TypingWebsocketController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ public function data(ServerRequestInterface $request, Document $document)
$actor = RequestUtil::getActor($request);

if ($actor->isGuest()) {
throw new PermissionDeniedException;
throw new PermissionDeniedException();
} else {
$this->pusher->trigger('presence-' . $data['discussionId'], 'typing', [
'userId' => $actor->id,
'avatarUrl' => $actor->avatar_url,
$this->pusher->trigger('presence-'.$data['discussionId'], 'typing', [
'userId' => $actor->id,
'avatarUrl' => $actor->avatar_url,
'displayName' => $actor->getDisplayNameAttribute(),
]);

return true;
}

}
}
2 changes: 1 addition & 1 deletion src/Commands/WebsocketServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected function configureStatistics()
if (!$this->option('disable-statistics')) {
$intervalInSeconds = $this->option('statistics-interval');

$this->info('Statistics will be saved every '. $intervalInSeconds . ' seconds');
$this->info('Statistics will be saved every '.$intervalInSeconds.' seconds');

$this->loop->addPeriodicTimer($intervalInSeconds, function () {
$this->line('Saving statistics...');
Expand Down
3 changes: 1 addition & 2 deletions src/WebSockets/SocketHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ public static function createForMessage(
MessageInterface $message,
ConnectionInterface $connection,
ChannelManager $channelManager
): PusherMessage
{
): PusherMessage {
$payload = json_decode($message->getPayload());

return Str::startsWith($payload->event, 'pusher:')
Expand Down

0 comments on commit 41f454a

Please sign in to comment.