fix(audit): add blockId to TEXT_SAVED audit payload
Required for dashboard Pulse stat 2 (COUNT DISTINCT blockId). Without it, two saves on different blocks on the same page were indistinguishable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -142,7 +142,8 @@ public class TranscriptionService {
|
|||||||
if (!text.equals(previousText)) {
|
if (!text.equals(previousText)) {
|
||||||
Optional<DocumentAnnotation> annotation = annotationRepository.findById(block.getAnnotationId());
|
Optional<DocumentAnnotation> annotation = annotationRepository.findById(block.getAnnotationId());
|
||||||
int pageNumber = annotation.map(DocumentAnnotation::getPageNumber).orElse(0);
|
int pageNumber = annotation.map(DocumentAnnotation::getPageNumber).orElse(0);
|
||||||
auditService.logAfterCommit(AuditKind.TEXT_SAVED, userId, documentId, Map.of("pageNumber", pageNumber));
|
auditService.logAfterCommit(AuditKind.TEXT_SAVED, userId, documentId,
|
||||||
|
Map.of("pageNumber", pageNumber, "blockId", saved.getId().toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Document doc = documentService.getDocumentById(documentId);
|
Document doc = documentService.getDocumentById(documentId);
|
||||||
|
|||||||
@@ -487,6 +487,7 @@ class TranscriptionServiceTest {
|
|||||||
org.mockito.ArgumentMatchers.eq(docId),
|
org.mockito.ArgumentMatchers.eq(docId),
|
||||||
payloadCaptor.capture());
|
payloadCaptor.capture());
|
||||||
assertThat(payloadCaptor.getValue()).containsEntry("pageNumber", 3);
|
assertThat(payloadCaptor.getValue()).containsEntry("pageNumber", 3);
|
||||||
|
assertThat(payloadCaptor.getValue()).containsEntry("blockId", blockId.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user