feat: entity patch

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-05-20 23:51:40 -04:00
parent 49712b5f87
commit 55dcd8a3f1
2 changed files with 34 additions and 1 deletions

View File

@@ -353,6 +353,9 @@ class RemoteMailService
$this->client->perform(new SelectCommand($collection, false));
$flagsToAdd = $this->normalizeFlags($flagsToAdd);
$flagsToRemove = $this->normalizeFlags($flagsToRemove);
if (!empty($flagsToAdd)) {
$this->client->perform(new StoreCommand(
FetchTarget::uid(SequenceSet::items(...array_values($uids))),
@@ -869,4 +872,23 @@ class RemoteMailService
return CollectionRoles::None->value;
}
private function normalizeFlags(array $flags): array
{
$map = [
'read' => '\\Seen',
'answered' => '\\Answered',
'flagged' => '\\Flagged',
'deleted' => '\\Deleted',
'draft' => '\\Draft',
];
$normalized = [];
foreach ($flags as $flag) {
$flag = strtolower(trim($flag));
if (isset($map[$flag])) {
$normalized[] = $map[$flag];
}
}
return $normalized;
}
}