Merge remote-tracking branch 'origin/1.5.x' into feat-smtp-test
This commit is contained in:
commit
f64989dd13
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3243,7 +3243,6 @@ App::put('/v1/account/targets/:targetId/push')
|
||||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||||
->label('sdk.response.model', Response::MODEL_TARGET)
|
->label('sdk.response.model', Response::MODEL_TARGET)
|
||||||
->label('docs', false)
|
|
||||||
->param('targetId', '', new UID(), 'Target ID.')
|
->param('targetId', '', new UID(), 'Target ID.')
|
||||||
->param('identifier', '', new Text(Database::LENGTH_KEY), 'The target identifier (token, email, phone etc.)')
|
->param('identifier', '', new Text(Database::LENGTH_KEY), 'The target identifier (token, email, phone etc.)')
|
||||||
->inject('queueForEvents')
|
->inject('queueForEvents')
|
||||||
|
|
|
@ -671,12 +671,11 @@ App::post('/v1/messaging/providers/apns')
|
||||||
->param('authKeyId', '', new Text(0), 'APNS authentication key ID.', true)
|
->param('authKeyId', '', new Text(0), 'APNS authentication key ID.', true)
|
||||||
->param('teamId', '', new Text(0), 'APNS team ID.', true)
|
->param('teamId', '', new Text(0), 'APNS team ID.', true)
|
||||||
->param('bundleId', '', new Text(0), 'APNS bundle 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)
|
->param('enabled', null, new Boolean(), 'Set as enabled.', true)
|
||||||
->inject('queueForEvents')
|
->inject('queueForEvents')
|
||||||
->inject('dbForProject')
|
->inject('dbForProject')
|
||||||
->inject('response')
|
->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;
|
$providerId = $providerId == 'unique()' ? ID::unique() : $providerId;
|
||||||
|
|
||||||
$credentials = [];
|
$credentials = [];
|
||||||
|
@ -697,17 +696,12 @@ App::post('/v1/messaging/providers/apns')
|
||||||
$credentials['bundleId'] = $bundleId;
|
$credentials['bundleId'] = $bundleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($endpoint)) {
|
|
||||||
$credentials['endpoint'] = $endpoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$enabled === true
|
$enabled === true
|
||||||
&& \array_key_exists('authKey', $credentials)
|
&& \array_key_exists('authKey', $credentials)
|
||||||
&& \array_key_exists('authKeyId', $credentials)
|
&& \array_key_exists('authKeyId', $credentials)
|
||||||
&& \array_key_exists('teamId', $credentials)
|
&& \array_key_exists('teamId', $credentials)
|
||||||
&& \array_key_exists('bundleId', $credentials)
|
&& \array_key_exists('bundleId', $credentials)
|
||||||
&& \array_key_exists('endpoint', $credentials)
|
|
||||||
) {
|
) {
|
||||||
$enabled = true;
|
$enabled = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1565,11 +1559,10 @@ App::patch('/v1/messaging/providers/apns/:providerId')
|
||||||
->param('authKeyId', '', new Text(0), 'APNS authentication key ID.', true)
|
->param('authKeyId', '', new Text(0), 'APNS authentication key ID.', true)
|
||||||
->param('teamId', '', new Text(0), 'APNS team ID.', true)
|
->param('teamId', '', new Text(0), 'APNS team ID.', true)
|
||||||
->param('bundleId', '', new Text(0), 'APNS bundle ID.', true)
|
->param('bundleId', '', new Text(0), 'APNS bundle ID.', true)
|
||||||
->param('endpoint', '', new Text(0), 'APNS endpoint.', true)
|
|
||||||
->inject('queueForEvents')
|
->inject('queueForEvents')
|
||||||
->inject('dbForProject')
|
->inject('dbForProject')
|
||||||
->inject('response')
|
->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);
|
$provider = $dbForProject->getDocument('providers', $providerId);
|
||||||
|
|
||||||
if ($provider->isEmpty()) {
|
if ($provider->isEmpty()) {
|
||||||
|
@ -1603,10 +1596,6 @@ App::patch('/v1/messaging/providers/apns/:providerId')
|
||||||
$credentials['bundle'] = $bundleId;
|
$credentials['bundle'] = $bundleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($endpoint)) {
|
|
||||||
$credentials['endpoint'] = $endpoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
$provider->setAttribute('credentials', $credentials);
|
$provider->setAttribute('credentials', $credentials);
|
||||||
|
|
||||||
if ($enabled === true || $enabled === false) {
|
if ($enabled === true || $enabled === false) {
|
||||||
|
@ -1616,7 +1605,6 @@ App::patch('/v1/messaging/providers/apns/:providerId')
|
||||||
&& \array_key_exists('authKeyId', $credentials)
|
&& \array_key_exists('authKeyId', $credentials)
|
||||||
&& \array_key_exists('teamId', $credentials)
|
&& \array_key_exists('teamId', $credentials)
|
||||||
&& \array_key_exists('bundleId', $credentials)
|
&& \array_key_exists('bundleId', $credentials)
|
||||||
&& \array_key_exists('endpoint', $credentials)
|
|
||||||
) {
|
) {
|
||||||
$enabled = true;
|
$enabled = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1696,12 +1684,9 @@ App::post('/v1/messaging/topics')
|
||||||
$topic = new Document([
|
$topic = new Document([
|
||||||
'$id' => $topicId,
|
'$id' => $topicId,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
|
'description' => $description
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($description) {
|
|
||||||
$topic->setAttribute('description', $description);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$topic = $dbForProject->createDocument('topics', $topic);
|
$topic = $dbForProject->createDocument('topics', $topic);
|
||||||
} catch (DuplicateException) {
|
} catch (DuplicateException) {
|
||||||
|
|
|
@ -348,7 +348,6 @@ class Messaging extends Action
|
||||||
$credentials['authKeyId'],
|
$credentials['authKeyId'],
|
||||||
$credentials['teamId'],
|
$credentials['teamId'],
|
||||||
$credentials['bundleId'],
|
$credentials['bundleId'],
|
||||||
$credentials['endpoint']
|
|
||||||
),
|
),
|
||||||
'fcm' => new FCM($credentials['serviceAccountJSON']),
|
'fcm' => new FCM($credentials['serviceAccountJSON']),
|
||||||
default => null
|
default => null
|
||||||
|
|
|
@ -1870,8 +1870,8 @@ trait Base
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$CREATE_APNS_PROVIDER:
|
case self::$CREATE_APNS_PROVIDER:
|
||||||
return 'mutation createApnsProvider($providerId: String!, $name: String!, $authKey: String!, $authKeyId: String!, $teamId: String!, $bundleId: String!, $endpoint: String!) {
|
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, endpoint: $endpoint) {
|
messagingCreateApnsProvider(providerId: $providerId, name: $name, authKey: $authKey, authKeyId: $authKeyId, teamId: $teamId, bundleId: $bundleId) {
|
||||||
_id
|
_id
|
||||||
name
|
name
|
||||||
provider
|
provider
|
||||||
|
@ -1984,8 +1984,8 @@ trait Base
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
case self::$UPDATE_APNS_PROVIDER:
|
case self::$UPDATE_APNS_PROVIDER:
|
||||||
return 'mutation updateApnsProvider($providerId: String!, $name: String!, $authKey: String!, $authKeyId: String!, $teamId: String!, $bundleId: String!, $endpoint: String!) {
|
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, endpoint: $endpoint) {
|
messagingUpdateApnsProvider(providerId: $providerId, name: $name, authKey: $authKey, authKeyId: $authKeyId, teamId: $teamId, bundleId: $bundleId) {
|
||||||
_id
|
_id
|
||||||
name
|
name
|
||||||
provider
|
provider
|
||||||
|
|
|
@ -87,7 +87,6 @@ class MessagingTest extends Scope
|
||||||
'authKeyId' => 'my-authkeyid',
|
'authKeyId' => 'my-authkeyid',
|
||||||
'teamId' => 'my-teamid',
|
'teamId' => 'my-teamid',
|
||||||
'bundleId' => 'my-bundleid',
|
'bundleId' => 'my-bundleid',
|
||||||
'endpoint' => 'my-endpoint',
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -177,7 +176,6 @@ class MessagingTest extends Scope
|
||||||
'authKeyId' => 'my-authkeyid',
|
'authKeyId' => 'my-authkeyid',
|
||||||
'teamId' => 'my-teamid',
|
'teamId' => 'my-teamid',
|
||||||
'bundleId' => 'my-bundleid',
|
'bundleId' => 'my-bundleid',
|
||||||
'endpoint' => 'my-endpoint',
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
foreach (\array_keys($providersParams) as $index => $key) {
|
foreach (\array_keys($providersParams) as $index => $key) {
|
||||||
|
|
|
@ -80,7 +80,6 @@ trait MessagingBase
|
||||||
'authKeyId' => 'my-authkeyid',
|
'authKeyId' => 'my-authkeyid',
|
||||||
'teamId' => 'my-teamid',
|
'teamId' => 'my-teamid',
|
||||||
'bundleId' => 'my-bundleid',
|
'bundleId' => 'my-bundleid',
|
||||||
'endpoint' => 'my-endpoint',
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$providers = [];
|
$providers = [];
|
||||||
|
@ -155,7 +154,6 @@ trait MessagingBase
|
||||||
'authKeyId' => 'my-authkeyid',
|
'authKeyId' => 'my-authkeyid',
|
||||||
'teamId' => 'my-teamid',
|
'teamId' => 'my-teamid',
|
||||||
'bundleId' => 'my-bundleid',
|
'bundleId' => 'my-bundleid',
|
||||||
'endpoint' => 'my-endpoint',
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
foreach (\array_keys($providersParams) as $index => $key) {
|
foreach (\array_keys($providersParams) as $index => $key) {
|
||||||
|
@ -245,6 +243,7 @@ trait MessagingBase
|
||||||
]);
|
]);
|
||||||
$this->assertEquals(201, $response['headers']['status-code']);
|
$this->assertEquals(201, $response['headers']['status-code']);
|
||||||
$this->assertEquals('my-app', $response['body']['name']);
|
$this->assertEquals('my-app', $response['body']['name']);
|
||||||
|
$this->assertEquals('', $response['body']['description']);
|
||||||
|
|
||||||
return $response['body'];
|
return $response['body'];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue