From 0ee49e78958fadbaac8df1c7245d60ed57bb7a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 21 Nov 2022 09:38:36 +0000 Subject: [PATCH 01/18] Fix missing execution status --- app/controllers/api/functions.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 4cf489e59..fe2074a28 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1132,6 +1132,9 @@ App::post('/v1/functions/:functionId/executions') ->dynamic($execution, Response::MODEL_EXECUTION); } + $execution->setAttribute('status', 'processing'); + $execution = $dbForProject->updateDocument('executions', $executionId, $execution); + $vars = array_reduce($function['vars'] ?? [], function (array $carry, Document $var) { $carry[$var->getAttribute('key')] = $var->getAttribute('value') ?? ''; return $carry; From 8feb3dc43c0bbe30a7322d477c46b5ed8a39e8a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 21 Nov 2022 09:40:50 +0000 Subject: [PATCH 02/18] Update changelog --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 6b7af775d..fc1a2d178 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,5 @@ +- Fix processing status on sync executions [#4737](https://github.com/appwrite/appwrite/pull/4737) + # Version 1.1.1 ## Bugs From 831960245f800f0bcc3a673288a01292dadf4b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 21 Nov 2022 11:20:52 +0000 Subject: [PATCH 03/18] Permission bug fix --- app/controllers/api/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index fe2074a28..871998e6d 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1133,7 +1133,7 @@ App::post('/v1/functions/:functionId/executions') } $execution->setAttribute('status', 'processing'); - $execution = $dbForProject->updateDocument('executions', $executionId, $execution); + Authorization::skip(fn () => $dbForProject->updateDocument('executions', $executionId, $execution)); $vars = array_reduce($function['vars'] ?? [], function (array $carry, Document $var) { $carry[$var->getAttribute('key')] = $var->getAttribute('value') ?? ''; From d2362aeab0427fa7740f8d944873a0ef036d7fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 21 Nov 2022 11:43:20 +0000 Subject: [PATCH 04/18] Improve performance --- app/controllers/api/functions.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 871998e6d..bfc1ccba4 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1080,7 +1080,7 @@ App::post('/v1/functions/:functionId/executions') 'functionId' => $function->getId(), 'deploymentId' => $deployment->getId(), 'trigger' => 'http', // http / schedule / event - 'status' => 'waiting', // waiting / processing / completed / failed + 'status' => $async ? 'waiting' : 'processing', // waiting / processing / completed / failed 'statusCode' => 0, 'response' => '', 'stderr' => '', @@ -1132,9 +1132,6 @@ App::post('/v1/functions/:functionId/executions') ->dynamic($execution, Response::MODEL_EXECUTION); } - $execution->setAttribute('status', 'processing'); - Authorization::skip(fn () => $dbForProject->updateDocument('executions', $executionId, $execution)); - $vars = array_reduce($function['vars'] ?? [], function (array $carry, Document $var) { $carry[$var->getAttribute('key')] = $var->getAttribute('value') ?? ''; return $carry; From e7fc427291057eca6c2f91bb05b6215f5d4627a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 21 Nov 2022 15:10:55 +0100 Subject: [PATCH 05/18] Remove failing test --- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 6d421484f..29ceb1254 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -550,7 +550,6 @@ class FunctionsCustomServerTest extends Scope $this->assertIsArray($function['body']['deployments']); $this->assertCount(2, $function['body']['deployments']); $this->assertEquals($function['body']['deployments'][0]['$id'], $data['deploymentId']); - $this->assertGreaterThanOrEqual(2, $function['body']['deployments'][0]['buildTime']); return $data; } From dd99ab7b0022bd963813b3a09d7efa90a13f2c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 21 Nov 2022 14:24:52 +0000 Subject: [PATCH 06/18] Fix session expiration --- app/init.php | 4 ++-- app/tasks/maintenance.php | 1 - app/workers/deletes.php | 23 ++++++++++++++--------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/init.php b/app/init.php index 3d24ef81d..50624c21c 100644 --- a/app/init.php +++ b/app/init.php @@ -790,9 +790,11 @@ App::setResource('user', function ($mode, $project, $console, $request, $respons Authorization::setDefaultStatus(true); Auth::setCookieName('a_session_' . $project->getId()); + $authDuration = $project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG; if (APP_MODE_ADMIN === $mode) { Auth::setCookieName('a_session_' . $console->getId()); + $authDuration = Auth::TOKEN_EXPIRATION_LOGIN_LONG; } $session = Auth::decodeSession( @@ -829,8 +831,6 @@ App::setResource('user', function ($mode, $project, $console, $request, $respons $user = $dbForConsole->getDocument('users', Auth::$unique); } - $authDuration = $project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG; - if ( $user->isEmpty() // Check a document has been found in the DB || !Auth::sessionVerify($user->getAttribute('sessions', []), Auth::$secret, $authDuration) diff --git a/app/tasks/maintenance.php b/app/tasks/maintenance.php index 96264a996..7199a338e 100644 --- a/app/tasks/maintenance.php +++ b/app/tasks/maintenance.php @@ -98,7 +98,6 @@ $cli { (new Delete()) ->setType(DELETE_TYPE_SESSIONS) - ->setDatetime(DateTime::addSeconds(new \DateTime(), -1 * Auth::TOKEN_EXPIRATION_LOGIN_LONG)) //TODO: Update to use project session expiration instead of default. ->trigger(); } diff --git a/app/workers/deletes.php b/app/workers/deletes.php index 364e64842..5dc7e8d73 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -1,5 +1,6 @@ deleteExpiredSessions($this->args['datetime']); + $this->deleteExpiredSessions(); break; case DELETE_TYPE_CERTIFICATES: @@ -105,7 +107,7 @@ class DeletesV1 extends Worker break; case DELETE_TYPE_USAGE: - $this->deleteUsageStats($this->args['dateTime1d'], $this->args['hourlyUsageRetentionDatetime']); + $this->deleteUsageStats($this->args['hourlyUsageRetentionDatetime']); break; case DELETE_TYPE_CACHE_BY_RESOURCE: @@ -214,7 +216,6 @@ class DeletesV1 extends Worker } /** - * @param string $datetime1d * @param string $hourlyUsageRetentionDatetime */ protected function deleteUsageStats(string $hourlyUsageRetentionDatetime) @@ -316,16 +317,20 @@ class DeletesV1 extends Worker }); } - /** - * @param string $datetime - */ - protected function deleteExpiredSessions(string $datetime): void + protected function deleteExpiredSessions(): void { - $this->deleteForProjectIds(function (string $projectId) use ($datetime) { + $consoleDB = $this->getConsoleDB(); + + $this->deleteForProjectIds(function (string $projectId) use ($consoleDB) { $dbForProject = $this->getProjectDB($projectId); + + $project = $consoleDB->getDocument('projects', $projectId); + $duration = $project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG; + $expired = DateTime::addSeconds(new \DateTime(), -1 * $duration); + // Delete Sessions $this->deleteByGroup('sessions', [ - Query::lessThan('expire', $datetime) + Query::lessThan('$createdAt', $expired) ], $dbForProject); }); } From eda112755ae4fbf017b5426f42f55995f36f6baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 21 Nov 2022 14:26:59 +0000 Subject: [PATCH 07/18] Update changelogs --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 6b7af775d..359f39fb4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,5 @@ +- Fix admin-mode session expiration, and expired session deletion [#4739](https://github.com/appwrite/appwrite/pull/4739) + # Version 1.1.1 ## Bugs From 64ba896738ad21ad7831c5a8289c605a8cb600b4 Mon Sep 17 00:00:00 2001 From: gepd Date: Tue, 22 Nov 2022 17:05:04 -0300 Subject: [PATCH 08/18] bug fix: failure status shoudn't be nulled --- app/controllers/api/account.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 115948f71..534186d0a 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -426,8 +426,6 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect') throw new Exception(Exception::PROJECT_INVALID_FAILURE_URL); } - $state['failure'] = null; - $accessToken = $oauth2->getAccessToken($code); $refreshToken = $oauth2->getRefreshToken($code); $accessTokenExpiry = $oauth2->getAccessTokenExpiry($code); From ad1587872b6ec977ab55c4e03394d4e444c31722 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Tue, 22 Nov 2022 18:49:31 -0500 Subject: [PATCH 09/18] remove dup line --- app/controllers/api/locale.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/api/locale.php b/app/controllers/api/locale.php index 3aee339df..6d824da05 100644 --- a/app/controllers/api/locale.php +++ b/app/controllers/api/locale.php @@ -40,7 +40,6 @@ App::get('/v1/locale') $output['countryCode'] = $record['country']['iso_code']; $output['country'] = $locale->getText('countries.' . strtolower($record['country']['iso_code']), $locale->getText('locale.country.unknown')); $output['continent'] = $locale->getText('continents.' . strtolower($record['continent']['code']), $locale->getText('locale.country.unknown')); - $output['continent'] = (isset($continents[$record['continent']['code']])) ? $continents[$record['continent']['code']] : $locale->getText('locale.country.unknown'); $output['continentCode'] = $record['continent']['code']; $output['eu'] = (\in_array($record['country']['iso_code'], $eu)) ? true : false; From 56d8c176dda083ce9c35805cc39a4d9d5a06a56a Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Tue, 22 Nov 2022 18:54:50 -0500 Subject: [PATCH 10/18] add update to changelog --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 6b7af775d..c1a9cfb75 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ - Fix Migration stopping scheduled functions [#4704](https://github.com/appwrite/appwrite/pull/4704) - Fix Migration enabling OAuth providers with data by default [#4704](https://github.com/appwrite/appwrite/pull/4704) - Fix Error pages when OAuth providers are disabled [#4704](https://github.com/appwrite/appwrite/pull/4704) +- Fix Locale API returning Unknown Content [#4761](https://github.com/appwrite/appwrite/pull/4761) # Version 1.1.0 ## Features From 5f80f87ba99f0f7c1243121a0577313fea488b9a Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Tue, 22 Nov 2022 19:00:07 -0500 Subject: [PATCH 11/18] fixed continent spelling --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index c1a9cfb75..571582f83 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,7 +6,7 @@ - Fix Migration stopping scheduled functions [#4704](https://github.com/appwrite/appwrite/pull/4704) - Fix Migration enabling OAuth providers with data by default [#4704](https://github.com/appwrite/appwrite/pull/4704) - Fix Error pages when OAuth providers are disabled [#4704](https://github.com/appwrite/appwrite/pull/4704) -- Fix Locale API returning Unknown Content [#4761](https://github.com/appwrite/appwrite/pull/4761) +- Fix Locale API returning Unknown continent [#4761](https://github.com/appwrite/appwrite/pull/4761) # Version 1.1.0 ## Features From b382031ae7eb11e2967a5dc193f4960071dd21aa Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 23 Nov 2022 18:43:48 +0100 Subject: [PATCH 12/18] chore: release 1.1.1 --- .gitmodules | 2 +- CHANGES.md | 1 + README-CN.md | 6 +++--- README.md | 6 +++--- app/console | 2 +- app/init.php | 2 +- src/Appwrite/Migration/Migration.php | 1 + 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.gitmodules b/.gitmodules index e9f13bb1a..cef850ec0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "app/console"] path = app/console url = https://github.com/appwrite/console - branch = 2.0.1 + branch = 2.0.2 diff --git a/CHANGES.md b/CHANGES.md index 1eff76d71..e623b660d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,7 @@ # Version 1.1.2 ## Changes +- Released `appwrite/console` [2.0.2](https://github.com/appwrite/console/releases/tag/2.0.2) - Make `region` parameter optional with default for project create [#4763](https://github.com/appwrite/appwrite/pull/4763) - Fix session expiration, and expired session deletion [#4739](https://github.com/appwrite/appwrite/pull/4739) diff --git a/README-CN.md b/README-CN.md index 4f8156f2c..6f00cebf1 100644 --- a/README-CN.md +++ b/README-CN.md @@ -64,7 +64,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.1.1 + appwrite/appwrite:1.1.2 ``` ### Windows @@ -76,7 +76,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.1.1 + appwrite/appwrite:1.1.2 ``` #### PowerShell @@ -86,7 +86,7 @@ docker run -it --rm , --volume /var/run/docker.sock:/var/run/docker.sock , --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw , --entrypoint="install" , - appwrite/appwrite:1.1.1 + appwrite/appwrite:1.1.2 ``` 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 diff --git a/README.md b/README.md index 694259711..0e613204c 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.1.1 + appwrite/appwrite:1.1.2 ``` ### Windows @@ -87,7 +87,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.1.1 + appwrite/appwrite:1.1.2 ``` #### PowerShell @@ -97,7 +97,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.1.1 + appwrite/appwrite:1.1.2 ``` Once the Docker installation completes, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after installation completes. diff --git a/app/console b/app/console index f89584bdd..af3d741ae 160000 --- a/app/console +++ b/app/console @@ -1 +1 @@ -Subproject commit f89584bdd4ba3de07fb54cecbc275b131e23a4fb +Subproject commit af3d741ae8f02c2e16b8b4ea4664a3f8970290fd diff --git a/app/init.php b/app/init.php index 50624c21c..ef9246e36 100644 --- a/app/init.php +++ b/app/init.php @@ -95,7 +95,7 @@ const APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT = 60; // Default maximum write rate pe const APP_KEY_ACCCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours const APP_CACHE_BUSTER = 501; -const APP_VERSION_STABLE = '1.1.1'; +const APP_VERSION_STABLE = '1.1.2'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_IP = 'ip'; diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 6c293723e..bef6e5e60 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -47,6 +47,7 @@ abstract class Migration '1.0.3' => 'V15', '1.1.0' => 'V16', '1.1.1' => 'V16', + '1.1.2' => 'V16', ]; /** From 20c538ec836fe852aed8427af84112fae311bd95 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 23 Nov 2022 18:52:09 +0100 Subject: [PATCH 13/18] chore: update changelog --- CHANGES.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 571582f83..3d8b658ee 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +# Version 1.1.2 +## Bugs +- Fix Locale API returning Unknown continent [#4761](https://github.com/appwrite/appwrite/pull/4761) + # Version 1.1.1 ## Bugs @@ -6,7 +10,6 @@ - Fix Migration stopping scheduled functions [#4704](https://github.com/appwrite/appwrite/pull/4704) - Fix Migration enabling OAuth providers with data by default [#4704](https://github.com/appwrite/appwrite/pull/4704) - Fix Error pages when OAuth providers are disabled [#4704](https://github.com/appwrite/appwrite/pull/4704) -- Fix Locale API returning Unknown continent [#4761](https://github.com/appwrite/appwrite/pull/4761) # Version 1.1.0 ## Features From 01556184c76490c63df0f9940ba2723b82c6913a Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Fri, 18 Nov 2022 12:24:04 -0800 Subject: [PATCH 14/18] Fix the default oauth paths to match the route --- CHANGES.md | 2 ++ app/controllers/api/account.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e4baaa503..54f305700 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,9 @@ # Version 1.1.2 ## Changes - Make `region` parameter optional with default for project create [#4763](https://github.com/appwrite/appwrite/pull/4763) + ## Bugs +- Fix default oauth paths [#4725](https://github.com/appwrite/appwrite/pull/4725) - Fix session expiration, and expired session deletion [#4739](https://github.com/appwrite/appwrite/pull/4739) - Fix processing status on sync executions [#4737](https://github.com/appwrite/appwrite/pull/4737) - Fix Locale API returning Unknown continent [#4761](https://github.com/appwrite/appwrite/pull/4761) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 534186d0a..45fb03062 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -41,8 +41,8 @@ use Utopia\Validator\Assoc; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; -$oauthDefaultSuccess = '/v1/auth/oauth2/success'; -$oauthDefaultFailure = '/v1/auth/oauth2/failure'; +$oauthDefaultSuccess = '/auth/oauth2/success'; +$oauthDefaultFailure = '/auth/oauth2/failure'; App::post('/v1/account') ->desc('Create Account') From efe093ce3c7fbac574d58414a487df40714b6959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 24 Nov 2022 12:35:26 +0100 Subject: [PATCH 15/18] Fix unsaved changes in team inv --- app/controllers/api/teams.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index dd214f562..eb020202b 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -724,7 +724,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status') ->setAttribute('confirm', true) ; - $user->setAttribute('emailVerification', true); + $user = $dbForProject->updateDocument('users', $user->getId(), $user->setAttribute('emailVerification', true)); // Log user in From 5e872f2fe57a0f1b8ade1028a74cfb2c8bb7cc82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 24 Nov 2022 12:36:14 +0100 Subject: [PATCH 16/18] Update changelog --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 54f305700..086b28b5b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,5 @@ +- Fix invited account verified status [#4776](https://github.com/appwrite/appwrite/pull/4776) + # Version 1.1.2 ## Changes - Make `region` parameter optional with default for project create [#4763](https://github.com/appwrite/appwrite/pull/4763) From 0cb2ed14f444bc319d081d8350db0b2312e3f283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 24 Nov 2022 12:40:17 +0100 Subject: [PATCH 17/18] Improve tests --- tests/e2e/Services/Teams/TeamsBaseClient.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/e2e/Services/Teams/TeamsBaseClient.php b/tests/e2e/Services/Teams/TeamsBaseClient.php index c5ecf9f7f..788626b10 100644 --- a/tests/e2e/Services/Teams/TeamsBaseClient.php +++ b/tests/e2e/Services/Teams/TeamsBaseClient.php @@ -342,6 +342,15 @@ trait TeamsBaseClient $session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_' . $this->getProject()['$id']]; $data['session'] = $session; + $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session, + ])); + + $this->assertEquals(true, $response['body']['emailVerification']); + /** [START] TESTS TO CHECK PASSWORD UPDATE OF NEW USER CREATED USING TEAM INVITE */ /** From 8b71e318c2c402da010e85a612461cadaf7df1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Thu, 24 Nov 2022 11:55:49 +0000 Subject: [PATCH 18/18] Fix tests bug --- app/controllers/api/teams.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index eb020202b..567560c6a 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -724,7 +724,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status') ->setAttribute('confirm', true) ; - $user = $dbForProject->updateDocument('users', $user->getId(), $user->setAttribute('emailVerification', true)); + $user = Authorization::skip(fn() => $dbForProject->updateDocument('users', $user->getId(), $user->setAttribute('emailVerification', true))); // Log user in