fix(qr): tell same-named salespeople apart; bilingual consent tick box

Member codes on the event page are labelled "name (username)", as in the
team list, and the consent tick box reads in English and Bahasa Malaysia.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-12-01 13:35:57 +08:00
1 parent 2d1513aa80
commit 9163557945
8 files changed
+72 -20

No files matched your search

@@ -78,7 +78,7 @@ class RegistrationLinkServiceTest {
void close() { http.close(); }
private void stubUser(long id, String name) {
Map<String, Object> u = new HashMap<>(Map.of("id", id, "name", name, "type", "A", "companyId", COMPANY, "enabled", true));
Map<String, Object> u = new HashMap<>(Map.of("id", id, "name", name, "username", "sales" + id, "type", "A", "companyId", COMPANY, "enabled", true));
when(rest.getForEntity(eq(USER), any(ParameterizedTypeReference.class), eq(id))).thenReturn(ResponseEntity.ok(u));
}
@@ -100,11 +100,23 @@ class RegistrationLinkServiceTest {
assertThat((Map<String, Object>) out.get("event")).containsEntry("token", "ev1").containsEntry("enabled", true);
assertThat((List<Map<String, Object>>) out.get("members")).containsExactly(
Map.of("userId", 21L, "name", "Sales One", "token", "t21", "enabled", true),
Map.of("userId", 22L, "name", "Sales Two", "token", "t22", "enabled", false));
Map.of("userId", 21L, "name", "Sales One", "username", "sales21", "token", "t21", "enabled", true),
Map.of("userId", 22L, "name", "Sales Two", "username", "sales22", "token", "t22", "enabled", false));
assertThat(posted(ENSURE)).containsEntry("companyId", COMPANY).containsEntry("eventUuid", EV).containsEntry("salespersonUserIds", List.of(21L, 22L));
}
@Test
void links_memberWithoutUsername_getsEmptyUsername() {
Map<String, Object> u = new HashMap<>(Map.of("id", 21L, "name", "Sales One", "type", "A", "companyId", COMPANY, "enabled", true));
when(rest.getForEntity(eq(USER), any(ParameterizedTypeReference.class), eq(21L))).thenReturn(ResponseEntity.ok(u));
when(rest.postForEntity(eq(ENSURE), any(ParameterizedTypeReference.class), any()))
.thenReturn(ResponseEntity.ok(List.of(Map.of("token", "t21", "enabled", true, "salespersonUserId", 21L))));
List<Map<String, Object>> members = (List<Map<String, Object>>) service.links(String.valueOf(EV)).get("members");
assertThat(members.get(0)).containsEntry("username", "");
}
@Test
void setEnabled_passesEventCompanyAndCallerUsername() {
when(rest.postForEntity(eq(SET), any(ParameterizedTypeReference.class), any())).thenReturn(ResponseEntity.ok(Map.of("token", "t21", "enabled", false)));