From 03b28fdb918c474a4aeac616aea40624f2a0e616 Mon Sep 17 00:00:00 2001 From: Everly Precia Suresh Date: Mon, 2 May 2022 18:06:12 +0000 Subject: [PATCH 1/2] refactor avatars.php --- app/controllers/api/avatars.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index 9d483bf2b7..d501e791c8 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -1,5 +1,7 @@ param('width', 400, new Range(0, 2000), 'Resize preview image width, Pass an integer between 0 to 2000.', true) ->param('height', 400, new Range(0, 2000), 'Resize preview image height, Pass an integer between 0 to 2000.', true) ->inject('response') - ->action(function ($url, $width, $height, $response) { - /** @var Appwrite\Utopia\Response $response */ + ->action(function ($url, $width, $height, Response $response) { $quality = 80; $output = 'png'; @@ -215,8 +214,7 @@ App::get('/v1/avatars/favicon') ->label('sdk.response.type', Response::CONTENT_TYPE_IMAGE) ->param('url', '', new URL(['http', 'https']), 'Website URL which you want to fetch the favicon from.') ->inject('response') - ->action(function ($url, $response) { - /** @var Appwrite\Utopia\Response $response */ + ->action(function ($url, Response $response) { $width = 56; $height = 56; @@ -371,8 +369,7 @@ App::get('/v1/avatars/qr') ->param('margin', 1, new Range(0, 10), 'Margin from edge. Pass an integer between 0 to 10. Defaults to 1.', true) ->param('download', false, new Boolean(true), 'Return resulting image with \'Content-Disposition: attachment \' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.', true) ->inject('response') - ->action(function ($text, $size, $margin, $download, $response) { - /** @var Appwrite\Utopia\Response $response */ + ->action(function ($text, $size, $margin, $download, Response $response) { $download = ($download === '1' || $download === 'true' || $download === 1 || $download === true); $options = new QROptions([ @@ -416,9 +413,7 @@ App::get('/v1/avatars/initials') ->param('background', '', new HexColor(), 'Changes background color. By default a random color will be picked and stay will persistent to the given name.', true) ->inject('response') ->inject('user') - ->action(function ($name, $width, $height, $color, $background, $response, $user) { - /** @var Appwrite\Utopia\Response $response */ - /** @var Utopia\Database\Document $user */ + ->action(function ($name, $width, $height, $color, $background, Response $response, Document $user) { $themes = [ ['color' => '#27005e', 'background' => '#e1d2f6'], // VIOLET From 5950289083caf05ab89ffbd9afc7202727e98a45 Mon Sep 17 00:00:00 2001 From: Everly Precia Suresh Date: Mon, 2 May 2022 18:30:13 +0000 Subject: [PATCH 2/2] retrigger build --- app/controllers/api/avatars.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index d501e791c8..e3b56cf588 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -16,7 +16,7 @@ use Utopia\Validator\Boolean; use Utopia\Validator\HexColor; use Utopia\Validator\Range; use Utopia\Validator\Text; -use Utopia\Validator\WhiteList; +use Utopia\Validator\WhiteList; $avatarCallback = function ($type, $code, $width, $height, $quality, Response $response) {