Compare commits
1 Commits
main
..
2e9a6a5857
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e9a6a5857 |
Generated
+7
-7
@@ -1442,16 +1442,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "12.5.31",
|
"version": "12.5.33",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "0608d157a284f15cc73b99a3327eff06b66a176d"
|
"reference": "b98e028a26c5c5ba7e4a54be96ccf35f2914d184"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0608d157a284f15cc73b99a3327eff06b66a176d",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b98e028a26c5c5ba7e4a54be96ccf35f2914d184",
|
||||||
"reference": "0608d157a284f15cc73b99a3327eff06b66a176d",
|
"reference": "b98e028a26c5c5ba7e4a54be96ccf35f2914d184",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -1520,7 +1520,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.31"
|
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.33"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -1528,7 +1528,7 @@
|
|||||||
"type": "other"
|
"type": "other"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-07-06T14:54:16+00:00"
|
"time": "2026-07-28T13:58:09+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/cli-parser",
|
"name": "sebastian/cli-parser",
|
||||||
@@ -2556,5 +2556,5 @@
|
|||||||
"platform-overrides": {
|
"platform-overrides": {
|
||||||
"php": "8.3"
|
"php": "8.3"
|
||||||
},
|
},
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.9.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -484,34 +484,17 @@ class Service implements ServiceBaseInterface, ServiceMutableInterface, ServiceC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($deleteMode === 'soft') {
|
// we need to determine if the folder being deleted is already in the trash
|
||||||
$targetMailbox = $this->mailService->collectionFetch((string) $target->collection());
|
if (str_starts_with((string) $target->collection(), (string) $deleteTargetIdentifier?->collection())) {
|
||||||
if ($targetMailbox === null) {
|
// if so, we should hard delete instead of moving to avoid duplicates in the trash
|
||||||
throw new \RuntimeException('Collection not found for delete operation');
|
$deleteMode = 'hard';
|
||||||
}
|
|
||||||
|
|
||||||
$targetIdentifier = (string) $target->collection();
|
|
||||||
$trashIdentifier = (string) $deleteTargetIdentifier->collection();
|
|
||||||
$parentIdentifier = isset($targetMailbox['parentId'])
|
|
||||||
? (string) $targetMailbox['parentId']
|
|
||||||
: null;
|
|
||||||
|
|
||||||
// JMAP mailbox IDs are opaque, so containment must be determined
|
|
||||||
// from parentId rather than by comparing ID prefixes.
|
|
||||||
if ($targetIdentifier === $trashIdentifier || $parentIdentifier === $trashIdentifier) {
|
|
||||||
$deleteMode = 'hard';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($deleteMode === 'soft') {
|
$result = match ($deleteMode) {
|
||||||
return $this->collectionMove($deleteTargetIdentifier, $target);
|
'soft' => $this->collectionMove($deleteTargetIdentifier, $target),
|
||||||
}
|
'hard' => $this->mailService->collectionDestroy($target->collection(), $force),
|
||||||
|
};
|
||||||
if ($this->mailService->collectionDestroy((string) $target->collection(), $force) === null) {
|
return $result;
|
||||||
throw new \RuntimeException("Failed to delete collection: {$target->collection()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectionMove(CollectionIdentifier $target, CollectionIdentifier $source): CollectionBaseInterface
|
public function collectionMove(CollectionIdentifier $target, CollectionIdentifier $source): CollectionBaseInterface
|
||||||
|
|||||||
@@ -912,29 +912,21 @@ class RemoteMailService {
|
|||||||
*
|
*
|
||||||
* @since Release 2.0.0
|
* @since Release 2.0.0
|
||||||
*/
|
*/
|
||||||
public function entitySubmitFresh(string $identityId, array $data, string $preSendTarget, string $postSentTarget): string {
|
public function entitySubmitFresh(string $identityId, array $message, string $preSendTarget, string $postSentTarget): string {
|
||||||
|
|
||||||
$message = new MailParametersRequest();
|
$mail = new MailParametersRequest();
|
||||||
$message->parametersRaw($data);
|
$mail->parametersRaw($message);
|
||||||
|
|
||||||
$messageId = 'm_' . uniqid();
|
$messageCreateId = 'm_' . uniqid();
|
||||||
$submissionId = 's_' . uniqid();
|
$submissionCreateId = 's_' . uniqid();
|
||||||
|
|
||||||
$r0 = new MailSet($this->dataAccount, null, $this->resourceNamespace, $this->resourceEntityLabel);
|
$r0 = new MailSet($this->dataAccount, null, $this->resourceNamespace, $this->resourceEntityLabel);
|
||||||
$m0 = $r0->create($messageId, $message);
|
$createdMessage = $r0->create($messageCreateId, $mail);
|
||||||
$m0->in($preSendTarget);
|
$createdMessage->in($preSendTarget);
|
||||||
$m0->draft(true);
|
|
||||||
$m0->seen(true);
|
|
||||||
|
|
||||||
$r1 = new MailSubmissionSet($this->dataAccount, null, $this->resourceNamespace, $this->resourceEntityLabel);
|
$r1 = new MailSubmissionSet($this->dataAccount, null, $this->resourceNamespace, $this->resourceEntityLabel);
|
||||||
$r1->completionUpdate('#' . $messageId, [
|
$submission = $r1->create($submissionCreateId);
|
||||||
'mailboxIds/' . $postSentTarget => true,
|
$submission->identity($identityId);
|
||||||
'mailboxIds/' . $preSendTarget => null,
|
$submission->message('#' . $messageCreateId);
|
||||||
'keywords/$draft' => null,
|
|
||||||
]);
|
|
||||||
$s0 = $r1->create($submissionId);
|
|
||||||
$s0->identity($identityId);
|
|
||||||
$s0->message('#' . $messageId);
|
|
||||||
|
|
||||||
$bundle = $this->dataStore->perform([$r0, $r1]);
|
$bundle = $this->dataStore->perform([$r0, $r1]);
|
||||||
$messageResponse = $bundle->response(0);
|
$messageResponse = $bundle->response(0);
|
||||||
@@ -942,7 +934,7 @@ class RemoteMailService {
|
|||||||
throw new Exception($messageResponse->type() . ': ' . $messageResponse->description(), 1);
|
throw new Exception($messageResponse->type() . ': ' . $messageResponse->description(), 1);
|
||||||
}
|
}
|
||||||
if (method_exists($messageResponse, 'createFailure')) {
|
if (method_exists($messageResponse, 'createFailure')) {
|
||||||
$failure = $messageResponse->createFailure($messageId);
|
$failure = $messageResponse->createFailure($messageCreateId);
|
||||||
if (is_array($failure)) {
|
if (is_array($failure)) {
|
||||||
$type = $failure['type'] ?? 'unknownError';
|
$type = $failure['type'] ?? 'unknownError';
|
||||||
$description = $failure['description'] ?? 'Email creation failed';
|
$description = $failure['description'] ?? 'Email creation failed';
|
||||||
@@ -958,7 +950,7 @@ class RemoteMailService {
|
|||||||
throw new Exception($response->type() . ': ' . $response->description(), 1);
|
throw new Exception($response->type() . ': ' . $response->description(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->extractSubmissionIdentifier($response, $submissionId);
|
return $this->extractSubmissionIdentifier($response, $submissionCreateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -986,18 +978,18 @@ class RemoteMailService {
|
|||||||
$requests = [];
|
$requests = [];
|
||||||
|
|
||||||
if ($patch !== null && $patch !== []) {
|
if ($patch !== null && $patch !== []) {
|
||||||
$m0 = new MailParametersRequest();
|
$draftMutation = new MailParametersRequest();
|
||||||
$m0->parametersRaw($patch);
|
$draftMutation->parametersRaw($patch);
|
||||||
$r0 = new MailSet($this->dataAccount, null, $this->resourceNamespace, $this->resourceEntityLabel);
|
$r0 = new MailSet($this->dataAccount, null, $this->resourceNamespace, $this->resourceEntityLabel);
|
||||||
$r0->update($draftId, $m0);
|
$r0->update($draftId, $draftMutation);
|
||||||
$requests[] = $r0;
|
$requests[] = $r0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$submissionId = 's_' . uniqid();
|
$submissionCreateId = 's_' . uniqid();
|
||||||
$r1 = new MailSubmissionSet($this->dataAccount, null, $this->resourceNamespace, $this->resourceEntityLabel);
|
$r1 = new MailSubmissionSet($this->dataAccount, null, $this->resourceNamespace, $this->resourceEntityLabel);
|
||||||
$s0 = $r1->create($submissionId);
|
$submission = $r1->create($submissionCreateId);
|
||||||
$s0->identity($identityId);
|
$submission->identity($identityId);
|
||||||
$s0->message($draftId);
|
$submission->message($draftId);
|
||||||
$requests[] = $r1;
|
$requests[] = $r1;
|
||||||
|
|
||||||
$bundle = $this->dataStore->perform($requests);
|
$bundle = $this->dataStore->perform($requests);
|
||||||
@@ -1010,7 +1002,19 @@ class RemoteMailService {
|
|||||||
throw new Exception($response->type() . ': ' . $response->description(), 1);
|
throw new Exception($response->type() . ': ' . $response->description(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->extractSubmissionIdentifier($response, $submissionId);
|
return $this->extractSubmissionIdentifier($response, $submissionCreateId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function collectionByRole(string $role): ?string {
|
||||||
|
$filter = $this->collectionListFilter();
|
||||||
|
$filter->condition('role', $role);
|
||||||
|
|
||||||
|
$collections = $this->collectionList(null, $filter, null);
|
||||||
|
if ($collections === []) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (string)array_key_first($collections);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function extractSubmissionIdentifier(object $response, string $createId): string {
|
private function extractSubmissionIdentifier(object $response, string $createId): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user