diff --git a/CHANGES.md b/CHANGES.md
index b8867b0e53..89f4609190 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -38,8 +38,9 @@
- Function execution environment variable `APPWRITE_FUNCTION_EVENT_PAYLOAD` renamed to `APPWRITE_FUNCTION_EVENT_DATA` (#1045)
- Function execution environment variable `APPWRITE_FUNCTION_ENV_NAME` renamed to `APPWRITE_FUNCTION_RUNTIME_NAME` (#1101)
- Function execution environment variable `APPWRITE_FUNCTION_ENV_VERSION` renamed to `APPWRITE_FUNCTION_RUNTIME_VERSION` (#1101)
-- Introdcues rate limits for:
+- Introduces rate limits for:
- Team invite (10 requests in every 60 minutes per IP address) (#1088)
+- Rename param `inviteId` to the more accurate `membershipId` in the Teams API (#1129)
# Version 0.7.2
diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php
index 910427da14..62836ea428 100644
--- a/app/controllers/api/teams.php
+++ b/app/controllers/api/teams.php
@@ -419,7 +419,7 @@ App::post('/v1/teams/:teamId/memberships')
}
$url = Template::parseURL($url);
- $url['query'] = Template::mergeQuery(((isset($url['query'])) ? $url['query'] : ''), ['inviteId' => $membership->getId(), 'teamId' => $team->getId(), 'userId' => $invitee->getId(), 'secret' => $secret, 'teamId' => $teamId]);
+ $url['query'] = Template::mergeQuery(((isset($url['query'])) ? $url['query'] : ''), ['membershipId' => $membership->getId(), 'teamId' => $team->getId(), 'userId' => $invitee->getId(), 'secret' => $secret, 'teamId' => $teamId]);
$url = Template::unParseURL($url);
$body = new Template(__DIR__.'/../../config/locale/templates/email-base.tpl');
@@ -524,7 +524,7 @@ App::get('/v1/teams/:teamId/memberships')
$response->dynamic(new Document(['sum' => $projectDB->getSum(), 'memberships' => $users]), Response::MODEL_MEMBERSHIP_LIST);
});
-App::patch('/v1/teams/:teamId/memberships/:inviteId/status')
+App::patch('/v1/teams/:teamId/memberships/:membershipId/status')
->desc('Update Team Membership Status')
->groups(['api', 'teams'])
->label('event', 'teams.memberships.update.status')
@@ -537,7 +537,7 @@ App::patch('/v1/teams/:teamId/memberships/:inviteId/status')
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MEMBERSHIP)
->param('teamId', '', new UID(), 'Team unique ID.')
- ->param('inviteId', '', new UID(), 'Invite unique ID.')
+ ->param('membershipId', '', new UID(), 'Membership ID.')
->param('userId', '', new UID(), 'User unique ID.')
->param('secret', '', new Text(256), 'Secret key.')
->inject('request')
@@ -546,7 +546,7 @@ App::patch('/v1/teams/:teamId/memberships/:inviteId/status')
->inject('projectDB')
->inject('geodb')
->inject('audits')
- ->action(function ($teamId, $inviteId, $userId, $secret, $request, $response, $user, $projectDB, $geodb, $audits) {
+ ->action(function ($teamId, $membershipId, $userId, $secret, $request, $response, $user, $projectDB, $geodb, $audits) {
/** @var Utopia\Swoole\Request $request */
/** @var Appwrite\Utopia\Response $response */
/** @var Appwrite\Database\Document $user */
@@ -555,7 +555,7 @@ App::patch('/v1/teams/:teamId/memberships/:inviteId/status')
/** @var Appwrite\Event\Event $audits */
$protocol = $request->getProtocol();
- $membership = $projectDB->getDocument($inviteId);
+ $membership = $projectDB->getDocument($membershipId);
if (empty($membership->getId()) || Database::SYSTEM_COLLECTION_MEMBERSHIPS != $membership->getCollection()) {
throw new Exception('Invite not found', 404);
@@ -671,7 +671,7 @@ App::patch('/v1/teams/:teamId/memberships/:inviteId/status')
])), Response::MODEL_MEMBERSHIP);
});
-App::delete('/v1/teams/:teamId/memberships/:inviteId')
+App::delete('/v1/teams/:teamId/memberships/:membershipId')
->desc('Delete Team Membership')
->groups(['api', 'teams'])
->label('event', 'teams.memberships.delete')
@@ -683,18 +683,18 @@ App::delete('/v1/teams/:teamId/memberships/:inviteId')
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
->label('sdk.response.model', Response::MODEL_NONE)
->param('teamId', '', new UID(), 'Team unique ID.')
- ->param('inviteId', '', new UID(), 'Invite unique ID.')
+ ->param('membershipId', '', new UID(), 'Membership ID.')
->inject('response')
->inject('projectDB')
->inject('audits')
->inject('events')
- ->action(function ($teamId, $inviteId, $response, $projectDB, $audits, $events) {
+ ->action(function ($teamId, $membershipId, $response, $projectDB, $audits, $events) {
/** @var Appwrite\Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */
/** @var Appwrite\Event\Event $audits */
/** @var Appwrite\Event\Event $events */
- $membership = $projectDB->getDocument($inviteId);
+ $membership = $projectDB->getDocument($membershipId);
if (empty($membership->getId()) || Database::SYSTEM_COLLECTION_MEMBERSHIPS != $membership->getCollection()) {
throw new Exception('Invite not found', 404);
diff --git a/app/views/console/settings/index.phtml b/app/views/console/settings/index.phtml
index 8cefd580cd..8af3d6e53f 100644
--- a/app/views/console/settings/index.phtml
+++ b/app/views/console/settings/index.phtml
@@ -415,7 +415,7 @@ $smtpEnabled = $this->getParam('smtpEnabled', false);
data-failure-param-alert-classname="error">
-
+
@@ -437,7 +437,7 @@ $smtpEnabled = $this->getParam('smtpEnabled', false);
data-failure-param-alert-classname="error">
-
+
diff --git a/app/views/console/users/team.phtml b/app/views/console/users/team.phtml
index ad6d263fac..912d123062 100644
--- a/app/views/console/users/team.phtml
+++ b/app/views/console/users/team.phtml
@@ -105,7 +105,7 @@
data-failure-param-alert-classname="error">
-
+
diff --git a/app/views/home/auth/join.phtml b/app/views/home/auth/join.phtml
index a857a29d59..481e8dcc30 100644
--- a/app/views/home/auth/join.phtml
+++ b/app/views/home/auth/join.phtml
@@ -9,7 +9,7 @@
data-scope="console"
data-event="submit"
data-param-team-id="{{router.params.teamId}}"
- data-param-invite-id="{{router.params.inviteId}}"
+ data-param-invite-id="{{router.params.membershipId}}"
data-param-user-id="{{router.params.userId}}"
data-param-secret="{{router.params.secret}}"
data-success="redirect,alert,trigger"
diff --git a/tests/e2e/Services/Teams/TeamsBaseClient.php b/tests/e2e/Services/Teams/TeamsBaseClient.php
index 72fc99d881..e41e5531ff 100644
--- a/tests/e2e/Services/Teams/TeamsBaseClient.php
+++ b/tests/e2e/Services/Teams/TeamsBaseClient.php
@@ -72,7 +72,7 @@ trait TeamsBaseClient
$this->assertEquals('Invitation to '.$teamName.' Team at '.$this->getProject()['name'], $lastEmail['subject']);
$secret = substr($lastEmail['text'], strpos($lastEmail['text'], '&secret=', 0) + 8, 256);
- $inviteUid = substr($lastEmail['text'], strpos($lastEmail['text'], '?inviteId=', 0) + 10, 13);
+ $membershipUid = substr($lastEmail['text'], strpos($lastEmail['text'], '?membershipId=', 0) + 14, 13);
$userUid = substr($lastEmail['text'], strpos($lastEmail['text'], '&userId=', 0) + 8, 13);
/**
@@ -117,7 +117,7 @@ trait TeamsBaseClient
return [
'teamUid' => $teamUid,
'secret' => $secret,
- 'inviteUid' => $inviteUid,
+ 'membershipUid' => $membershipUid,
'userUid' => $userUid,
];
}
@@ -129,13 +129,13 @@ trait TeamsBaseClient
{
$teamUid = $data['teamUid'] ?? '';
$secret = $data['secret'] ?? '';
- $inviteUid = $data['inviteUid'] ?? '';
+ $membershipUid = $data['membershipUid'] ?? '';
$userUid = $data['userUid'] ?? '';
/**
* Test for SUCCESS
*/
- $response = $this->client->call(Client::METHOD_PATCH, '/teams/'.$teamUid.'/memberships/'.$inviteUid.'/status', array_merge([
+ $response = $this->client->call(Client::METHOD_PATCH, '/teams/'.$teamUid.'/memberships/'.$membershipUid.'/status', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -155,7 +155,7 @@ trait TeamsBaseClient
/**
* Test for FAILURE
*/
- $response = $this->client->call(Client::METHOD_PATCH, '/teams/'.$teamUid.'/memberships/'.$inviteUid.'/status', array_merge([
+ $response = $this->client->call(Client::METHOD_PATCH, '/teams/'.$teamUid.'/memberships/'.$membershipUid.'/status', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -166,7 +166,7 @@ trait TeamsBaseClient
$this->assertEquals(401, $response['headers']['status-code']);
- $response = $this->client->call(Client::METHOD_PATCH, '/teams/'.$teamUid.'/memberships/'.$inviteUid.'/status', array_merge([
+ $response = $this->client->call(Client::METHOD_PATCH, '/teams/'.$teamUid.'/memberships/'.$membershipUid.'/status', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -177,7 +177,7 @@ trait TeamsBaseClient
$this->assertEquals(400, $response['headers']['status-code']);
- $response = $this->client->call(Client::METHOD_PATCH, '/teams/'.$teamUid.'/memberships/'.$inviteUid.'/status', array_merge([
+ $response = $this->client->call(Client::METHOD_PATCH, '/teams/'.$teamUid.'/memberships/'.$membershipUid.'/status', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -188,7 +188,7 @@ trait TeamsBaseClient
$this->assertEquals(401, $response['headers']['status-code']);
- $response = $this->client->call(Client::METHOD_PATCH, '/teams/'.$teamUid.'/memberships/'.$inviteUid.'/status', array_merge([
+ $response = $this->client->call(Client::METHOD_PATCH, '/teams/'.$teamUid.'/memberships/'.$membershipUid.'/status', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -208,12 +208,12 @@ trait TeamsBaseClient
public function testDeleteTeamMembership($data):array
{
$teamUid = $data['teamUid'] ?? '';
- $inviteUid = $data['inviteUid'] ?? '';
+ $membershipUid = $data['membershipUid'] ?? '';
/**
* Test for SUCCESS
*/
- $response = $this->client->call(Client::METHOD_DELETE, '/teams/'.$teamUid.'/memberships/'.$inviteUid, array_merge([
+ $response = $this->client->call(Client::METHOD_DELETE, '/teams/'.$teamUid.'/memberships/'.$membershipUid, array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -225,7 +225,7 @@ trait TeamsBaseClient
/**
* Test for FAILURE
*/
- $response = $this->client->call(Client::METHOD_GET, '/teams/'.$teamUid.'/memberships/'.$inviteUid, array_merge([
+ $response = $this->client->call(Client::METHOD_GET, '/teams/'.$teamUid.'/memberships/'.$membershipUid, array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
diff --git a/tests/e2e/Services/Webhooks/WebhooksBase.php b/tests/e2e/Services/Webhooks/WebhooksBase.php
index 5dc6cfafe2..060e8ad0a7 100644
--- a/tests/e2e/Services/Webhooks/WebhooksBase.php
+++ b/tests/e2e/Services/Webhooks/WebhooksBase.php
@@ -464,7 +464,7 @@ trait WebhooksBase
$lastEmail = $this->getLastEmail();
$secret = substr($lastEmail['text'], strpos($lastEmail['text'], '&secret=', 0) + 8, 256);
- $inviteUid = substr($lastEmail['text'], strpos($lastEmail['text'], '?inviteId=', 0) + 10, 13);
+ $membershipUid = substr($lastEmail['text'], strpos($lastEmail['text'], '?membershipId=', 0) + 14, 13);
$userUid = substr($lastEmail['text'], strpos($lastEmail['text'], '&userId=', 0) + 8, 13);
$webhook = $this->getLastRequest();
@@ -490,7 +490,7 @@ trait WebhooksBase
return [
'teamId' => $teamUid,
'secret' => $secret,
- 'inviteId' => $inviteUid,
+ 'membershipId' => $membershipUid,
'userId' => $webhook['data']['userId'],
];
}
diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php
index f4ed81ac0f..3328c71f1c 100644
--- a/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php
+++ b/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php
@@ -714,13 +714,13 @@ class WebhooksCustomClientTest extends Scope
{
$teamUid = $data['teamId'] ?? '';
$secret = $data['secret'] ?? '';
- $inviteUid = $data['inviteId'] ?? '';
+ $membershipUid = $data['membershipId'] ?? '';
$userUid = $data['userId'] ?? '';
/**
* Test for SUCCESS
*/
- $team = $this->client->call(Client::METHOD_PATCH, '/teams/'.$teamUid.'/memberships/'.$inviteUid.'/status', array_merge([
+ $team = $this->client->call(Client::METHOD_PATCH, '/teams/'.$teamUid.'/memberships/'.$membershipUid.'/status', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],