From 48e427a3794817e35375cb09db4e4d2ba4f482e3 Mon Sep 17 00:00:00 2001 From: Charlie Date: Sat, 8 Apr 2017 09:33:05 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Api/Controllers/ServeStrikeController.php | 18 ++++++++++-------- src/Commands/RegisterUser.php | 2 +- src/Commands/RegisterUserHandler.php | 3 +-- src/Validators/UserValidator.php | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/Api/Controllers/ServeStrikeController.php b/src/Api/Controllers/ServeStrikeController.php index e0478fe..6b0a9f7 100644 --- a/src/Api/Controllers/ServeStrikeController.php +++ b/src/Api/Controllers/ServeStrikeController.php @@ -1,4 +1,5 @@ -bus = $bus; } - + protected function data(ServerRequestInterface $request, Document $document) { $actor = $request->getAttribute('actor'); $id = array_get($request->getParsedBody(), 'id'); if (isset($id)) { - return $this->bus->dispatch( + return $this->bus->dispatch( new DeleteStrike($id, $actor) ); } else { $post_id = array_get($request->getParsedBody(), 'post_id'); $reason = array_get($request->getParsedBody(), 'reason'); + return $this->bus->dispatch( new ServeStrike($post_id, $reason, $actor) ); } } -} \ No newline at end of file +} diff --git a/src/Commands/RegisterUser.php b/src/Commands/RegisterUser.php index f3d075d..9f44b00 100644 --- a/src/Commands/RegisterUser.php +++ b/src/Commands/RegisterUser.php @@ -39,7 +39,7 @@ public function __construct(User $actor, array $data) { if (app()->make(SettingsRepositoryInterface::class)->get('ReFlar-recaptcha') == true) { app()->make(RecaptchaValidator::class)->assertValid([ - 'g-recaptcha-response' => array_get($data, 'attributes.g-recaptcha-response') + 'g-recaptcha-response' => array_get($data, 'attributes.g-recaptcha-response'), ]); } $this->actor = $actor; diff --git a/src/Commands/RegisterUserHandler.php b/src/Commands/RegisterUserHandler.php index aa04323..83c8b22 100644 --- a/src/Commands/RegisterUserHandler.php +++ b/src/Commands/RegisterUserHandler.php @@ -104,9 +104,8 @@ public function handle(RegisterUser $command) $age = array_get($data, 'attributes.age'); $gender = ucfirst(strtolower(array_get($data, 'attributes.gender'))); - if ($this->settings->get('ReFlar-emailRegEnabled') == true) { - $email = $username . '@' . $username . '.com'; + $email = $username.'@'.$username.'.com'; } // If a valid authentication token was provided as an attribute, // then we won't require the user to choose a password. diff --git a/src/Validators/UserValidator.php b/src/Validators/UserValidator.php index d64875c..f1b12d5 100644 --- a/src/Validators/UserValidator.php +++ b/src/Validators/UserValidator.php @@ -61,7 +61,7 @@ protected function getRules() ]; $this->settings = app()->make(SettingsRepositoryInterface::class); - + if ($this->settings->get('ReFlar-emailRegEnabled') == false) { $validator['email'] = ['required', 'email', 'unique:users,email'.$idSuffix]; }