From e7d37972342311a364fff750302e01242cb19d08 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Tue, 9 Jan 2024 19:22:39 +0000 Subject: [PATCH] Remove the endpoint param for APNS providers The endpoint was removed from utopia-php/messaging. --- app/controllers/api/messaging.php | 16 ++-------------- src/Appwrite/Platform/Workers/Messaging.php | 1 - tests/e2e/Services/GraphQL/Base.php | 8 ++++---- tests/e2e/Services/GraphQL/MessagingTest.php | 2 -- tests/e2e/Services/Messaging/MessagingBase.php | 2 -- 5 files changed, 6 insertions(+), 23 deletions(-) diff --git a/app/controllers/api/messaging.php b/app/controllers/api/messaging.php index 9a9fdb8b16..c9dd041a80 100644 --- a/app/controllers/api/messaging.php +++ b/app/controllers/api/messaging.php @@ -671,12 +671,11 @@ App::post('/v1/messaging/providers/apns') ->param('authKeyId', '', new Text(0), 'APNS authentication key ID.', true) ->param('teamId', '', new Text(0), 'APNS team ID.', true) ->param('bundleId', '', new Text(0), 'APNS bundle ID.', true) - ->param('endpoint', '', new Text(0), 'APNS endpoint.', true) ->param('enabled', null, new Boolean(), 'Set as enabled.', true) ->inject('queueForEvents') ->inject('dbForProject') ->inject('response') - ->action(function (string $providerId, string $name, string $authKey, string $authKeyId, string $teamId, string $bundleId, string $endpoint, ?bool $enabled, Event $queueForEvents, Database $dbForProject, Response $response) { + ->action(function (string $providerId, string $name, string $authKey, string $authKeyId, string $teamId, string $bundleId, ?bool $enabled, Event $queueForEvents, Database $dbForProject, Response $response) { $providerId = $providerId == 'unique()' ? ID::unique() : $providerId; $credentials = []; @@ -697,17 +696,12 @@ App::post('/v1/messaging/providers/apns') $credentials['bundleId'] = $bundleId; } - if (!empty($endpoint)) { - $credentials['endpoint'] = $endpoint; - } - if ( $enabled === true && \array_key_exists('authKey', $credentials) && \array_key_exists('authKeyId', $credentials) && \array_key_exists('teamId', $credentials) && \array_key_exists('bundleId', $credentials) - && \array_key_exists('endpoint', $credentials) ) { $enabled = true; } else { @@ -1565,11 +1559,10 @@ App::patch('/v1/messaging/providers/apns/:providerId') ->param('authKeyId', '', new Text(0), 'APNS authentication key ID.', true) ->param('teamId', '', new Text(0), 'APNS team ID.', true) ->param('bundleId', '', new Text(0), 'APNS bundle ID.', true) - ->param('endpoint', '', new Text(0), 'APNS endpoint.', true) ->inject('queueForEvents') ->inject('dbForProject') ->inject('response') - ->action(function (string $providerId, string $name, ?bool $enabled, string $authKey, string $authKeyId, string $teamId, string $bundleId, string $endpoint, Event $queueForEvents, Database $dbForProject, Response $response) { + ->action(function (string $providerId, string $name, ?bool $enabled, string $authKey, string $authKeyId, string $teamId, string $bundleId, Event $queueForEvents, Database $dbForProject, Response $response) { $provider = $dbForProject->getDocument('providers', $providerId); if ($provider->isEmpty()) { @@ -1603,10 +1596,6 @@ App::patch('/v1/messaging/providers/apns/:providerId') $credentials['bundle'] = $bundleId; } - if (!empty($endpoint)) { - $credentials['endpoint'] = $endpoint; - } - $provider->setAttribute('credentials', $credentials); if ($enabled === true || $enabled === false) { @@ -1616,7 +1605,6 @@ App::patch('/v1/messaging/providers/apns/:providerId') && \array_key_exists('authKeyId', $credentials) && \array_key_exists('teamId', $credentials) && \array_key_exists('bundleId', $credentials) - && \array_key_exists('endpoint', $credentials) ) { $enabled = true; } else { diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index ebf657ecc5..103794676b 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -345,7 +345,6 @@ class Messaging extends Action $credentials['authKeyId'], $credentials['teamId'], $credentials['bundleId'], - $credentials['endpoint'] ), 'fcm' => new FCM($credentials['serviceAccountJSON']), default => null diff --git a/tests/e2e/Services/GraphQL/Base.php b/tests/e2e/Services/GraphQL/Base.php index 2c630e3f75..52e59ed001 100644 --- a/tests/e2e/Services/GraphQL/Base.php +++ b/tests/e2e/Services/GraphQL/Base.php @@ -1870,8 +1870,8 @@ trait Base } }'; case self::$CREATE_APNS_PROVIDER: - return 'mutation createApnsProvider($providerId: String!, $name: String!, $authKey: String!, $authKeyId: String!, $teamId: String!, $bundleId: String!, $endpoint: String!) { - messagingCreateApnsProvider(providerId: $providerId, name: $name, authKey: $authKey, authKeyId: $authKeyId, teamId: $teamId, bundleId: $bundleId, endpoint: $endpoint) { + return 'mutation createApnsProvider($providerId: String!, $name: String!, $authKey: String!, $authKeyId: String!, $teamId: String!, $bundleId: String!) { + messagingCreateApnsProvider(providerId: $providerId, name: $name, authKey: $authKey, authKeyId: $authKeyId, teamId: $teamId, bundleId: $bundleId) { _id name provider @@ -1984,8 +1984,8 @@ trait Base } }'; case self::$UPDATE_APNS_PROVIDER: - return 'mutation updateApnsProvider($providerId: String!, $name: String!, $authKey: String!, $authKeyId: String!, $teamId: String!, $bundleId: String!, $endpoint: String!) { - messagingUpdateApnsProvider(providerId: $providerId, name: $name, authKey: $authKey, authKeyId: $authKeyId, teamId: $teamId, bundleId: $bundleId, endpoint: $endpoint) { + return 'mutation updateApnsProvider($providerId: String!, $name: String!, $authKey: String!, $authKeyId: String!, $teamId: String!, $bundleId: String!) { + messagingUpdateApnsProvider(providerId: $providerId, name: $name, authKey: $authKey, authKeyId: $authKeyId, teamId: $teamId, bundleId: $bundleId) { _id name provider diff --git a/tests/e2e/Services/GraphQL/MessagingTest.php b/tests/e2e/Services/GraphQL/MessagingTest.php index 1828411483..6cdb12473d 100644 --- a/tests/e2e/Services/GraphQL/MessagingTest.php +++ b/tests/e2e/Services/GraphQL/MessagingTest.php @@ -87,7 +87,6 @@ class MessagingTest extends Scope 'authKeyId' => 'my-authkeyid', 'teamId' => 'my-teamid', 'bundleId' => 'my-bundleid', - 'endpoint' => 'my-endpoint', ], ]; @@ -177,7 +176,6 @@ class MessagingTest extends Scope 'authKeyId' => 'my-authkeyid', 'teamId' => 'my-teamid', 'bundleId' => 'my-bundleid', - 'endpoint' => 'my-endpoint', ], ]; foreach (\array_keys($providersParams) as $index => $key) { diff --git a/tests/e2e/Services/Messaging/MessagingBase.php b/tests/e2e/Services/Messaging/MessagingBase.php index bb09e0a247..d2edb6d5af 100644 --- a/tests/e2e/Services/Messaging/MessagingBase.php +++ b/tests/e2e/Services/Messaging/MessagingBase.php @@ -80,7 +80,6 @@ trait MessagingBase 'authKeyId' => 'my-authkeyid', 'teamId' => 'my-teamid', 'bundleId' => 'my-bundleid', - 'endpoint' => 'my-endpoint', ], ]; $providers = []; @@ -155,7 +154,6 @@ trait MessagingBase 'authKeyId' => 'my-authkeyid', 'teamId' => 'my-teamid', 'bundleId' => 'my-bundleid', - 'endpoint' => 'my-endpoint', ], ]; foreach (\array_keys($providersParams) as $index => $key) {