fix: increment composition revision on attachment add and remove

Signed-off-by: Sebastian <krupinski01@gmail.com>
This commit is contained in:
2026-08-25 22:10:19 -04:00
parent 684d50062c
commit 0c7f103353
4 changed files with 105 additions and 1 deletions
+4
View File
@@ -582,6 +582,7 @@ class CompositionManager {
$deviceAttachmentsChanged = $uploads !== [];
$documentAttachmentsChanged = count($failed) < count($documents);
if ($deviceAttachmentsChanged || $documentAttachmentsChanged) {
$composed['revision'] = (int)($composed['revision'] ?? 0) + 1;
$composed = $this->markRemoteDirty($composed);
$compositionChanged = true;
}
@@ -616,6 +617,7 @@ class CompositionManager {
];
}
if ($compositionChanged) {
$result['revision'] = (int)($composed['revision'] ?? 0);
$event = new CompositionSavedEvent($tenantId, $userId, $composition, (int)($composed['revision'] ?? 0));
$this->events->dispatch($event);
}
@@ -774,8 +776,10 @@ class CompositionManager {
}
unset($composed['attachments'][$identifier]);
$composed['revision'] = (int)($composed['revision'] ?? 0) + 1;
$composed = $this->markRemoteDirty($composed);
$result['disposition'] = 'removed';
$result['revision'] = $composed['revision'];
return $composed;
};