Compare commits
2 Commits
13e0801b30
...
091f6c7592
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
091f6c7592 | ||
|
|
3a6f90441e |
@@ -0,0 +1,5 @@
|
|||||||
|
-- Prevent duplicate sidecar rows for the same (block, person) pair.
|
||||||
|
-- @ElementCollection uses DELETE+INSERT per update so normal JPA writes can't
|
||||||
|
-- create duplicates, but a raw-SQL import or concurrent bypass of JPA could.
|
||||||
|
ALTER TABLE transcription_block_mentioned_persons
|
||||||
|
ADD CONSTRAINT uq_tbmp_block_person UNIQUE (block_id, person_id);
|
||||||
@@ -26,6 +26,7 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.assertj.core.api.Assertions.assertThatCode;
|
||||||
|
|
||||||
@DataJpaTest
|
@DataJpaTest
|
||||||
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
|
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
|
||||||
@@ -195,6 +196,17 @@ class PersonMentionPropagationListenerTest {
|
|||||||
assertThat(first.getText()).contains("@Augusta Raddatz");
|
assertThat(first.getText()).contains("@Augusta Raddatz");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void doesNotThrow_whenBlockTextIsNull() {
|
||||||
|
UUID personId = savedPersonId("Auguste", "Raddatz");
|
||||||
|
saveBlock(null, List.of(new PersonMention(personId, "Auguste Raddatz")));
|
||||||
|
em.clear();
|
||||||
|
|
||||||
|
assertThatCode(() -> listener.onPersonDisplayNameChanged(
|
||||||
|
new PersonDisplayNameChangedEvent(personId, "Auguste Raddatz", "Augusta Raddatz")))
|
||||||
|
.doesNotThrowAnyException();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void leavesUnrelatedBlockUntouched_whenNoSidecarReferencesPerson() {
|
void leavesUnrelatedBlockUntouched_whenNoSidecarReferencesPerson() {
|
||||||
UUID personId = savedPersonId("Auguste", "Raddatz");
|
UUID personId = savedPersonId("Auguste", "Raddatz");
|
||||||
|
|||||||
Reference in New Issue
Block a user