fix(mobile-api): keep a deactivated member already on an event's team
Only users being added must be active admins; someone already on the team stays until an admin removes them, so an unrelated event edit no longer fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
2efdcba1ae
commit
33f1e7a505
3 files changed
+27
-6
No files matched your search
+17
@@ -64,6 +64,8 @@ class AdminEventServiceTest {
|
||||
when(rest.postForEntity(eq(SAVE), any(ParameterizedTypeReference.class), any()))
|
||||
.thenAnswer(i -> ResponseEntity.ok(i.getArgument(2)));
|
||||
when(rest.postForEntity(eq(REPLACE), any(ParameterizedTypeReference.class), any())).thenReturn(ResponseEntity.ok(List.of()));
|
||||
// default: the event has no team yet (tests that need one stub TEAM themselves)
|
||||
when(rest.getForEntity(eq(TEAM), any(ParameterizedTypeReference.class), any())).thenReturn(ResponseEntity.ok(List.of()));
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
@@ -379,6 +381,21 @@ class AdminEventServiceTest {
|
||||
verify(rest, never()).postForEntity(eq(SAVE), any(ParameterizedTypeReference.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void update_keepsADeactivatedMemberAlreadyOnTheTeam() {
|
||||
stubFind(event());
|
||||
when(rest.getForEntity(eq(TEAM), any(ParameterizedTypeReference.class), eq(UUID)))
|
||||
.thenReturn(ResponseEntity.ok(List.of(Map.of("userId", 2))));
|
||||
stubUser(2, "A", false);
|
||||
stubUser(3, "A", true);
|
||||
when(rest.postForEntity(eq(SAVE), any(ParameterizedTypeReference.class), any()))
|
||||
.thenAnswer(i -> ResponseEntity.ok(i.getArgument(2)));
|
||||
|
||||
service.update(String.valueOf(UUID), req("N", "L", "2027-01-01", "2027-01-02", List.of(2L, 3L)));
|
||||
|
||||
assertThat(replaceBody()).containsEntry("userIds", List.of(2L, 3L));
|
||||
}
|
||||
|
||||
@Test
|
||||
void salespersonOptions_onlyEnabledTypeAUsersSortedByName() {
|
||||
List<Map<String, Object>> users = List.of(
|
||||
|
||||
Reference in new issue
Block a user