v2.0.2 — English tag aliases, English-only website, undo-body flaky fix

- tags: accept #birthday and #appointment as English synonyms for
  #geburtstag and #termin. Normalised to the German canonical form at
  extractTags() write-time so every downstream check (parseTags /
  calendar logic / board filters) keeps working without per-call-site
  aliasing. Editor body-regex extended so the "new appointment"
  heuristic and auto-sync trigger on either variant.
- website: replace #termin/#geburtstag with #appointment/#birthday in
  tag chips, calendar feature list, and calendar legend.
- tests: fix flaky "Undo: Editor Save → Ctrl+Z reverts body change"
  that raced doSave(). The test polled the server for the patched body
  and fired Ctrl+Z as soon as it landed, but the undo shortcut is
  guarded by !guards.isOpen('modal'), and closeModal() only runs after
  the post-patch _reloadAll — on fast servers the key was swallowed.
  Poll now also waits for the modal `.open` class to drop.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
thandClaude Opus 4.7 committed 2026-04-18 10:04:08 +02:00
1 parent 89d84d3538
commit 48b5907f4c
6 files changed
+25 -12

No files matched your search

+8 -1
View File
@@ -273,7 +273,14 @@ if (str_starts_with($route, '/api/')) {
function validInt($v, $default = 0) { return is_numeric($v) ? (int)$v : $default; }
function extractTags($body) {
preg_match_all('/(?<=\s|^)#([a-zA-Z0-9_\/-][a-zA-Z0-9_\/-]*[a-zA-Z0-9_-]|[a-zA-Z0-9_-]+)/m', $body ?? '', $matches);
return implode(',', array_unique(array_map('strtolower', $matches[1] ?? [])));
// English ↔ German tag aliases: the calendar + journal logic is
// hardcoded against 'geburtstag' / 'termin', so accept the English
// synonyms and normalise to the canonical German form at write
// time. Keeps every downstream check (card.tags includes 'geburtstag')
// working without touching dozens of JS call sites.
$aliases = ['birthday' => 'geburtstag', 'appointment' => 'termin'];
$tags = array_map(fn($t) => $aliases[$t] ?? $t, array_map('strtolower', $matches[1] ?? []));
return implode(',', array_unique($tags));
}
// Plugin route handlers (registered by plugin backend.php files).
+2 -2
View File
@@ -234,7 +234,7 @@ export function openModal(card = null) {
// `card` can be `null` (add-button new) or a shell `{id: null, ...}`
// from the calendar day-popup — both count as "new", so key on
// card?.id not the card ref itself.
const isNewAppointment = !card?.id && /#(termin|geburtstag)\b/.test(body.value);
const isNewAppointment = !card?.id && /#(termin|appointment|geburtstag|birthday)\b/.test(body.value);
inpBucket.value = card?.bucket_id ? card.bucket_id
: (isNewAppointment ? ''
: (!virtualBuckets.includes(state.activeBucket) ? state.activeBucket : ''));
@@ -512,7 +512,7 @@ async function doSave(close, { animate = true } = {}) {
}
await window._reloadAll();
// Auto-sync if card has #termin or #geburtstag
if (data.body && /#(termin|geburtstag)\b/.test(data.body)) {
if (data.body && /#(termin|appointment|geburtstag|birthday)\b/.test(data.body)) {
window._triggerSync?.();
}
if (close) {
+7 -1
View File
@@ -109,11 +109,17 @@ describe('Undo: Editor Save', () => {
bodyEl.dispatchEvent(new Event('input', { bubbles: true }));
click('#modal-save-close');
// Wait for both the server patch AND the modal close before firing
// Ctrl+Z — the global undo shortcut is guarded by
// `!guards.isOpen('modal')`, so if doSave's closeModal() hasn't run
// yet (it only fires after the post-save _reloadAll), the undo key
// is swallowed silently and the test races the client's save flow.
let card;
for (let i = 0; i < 40; i++) {
await sleep(100);
card = (await fetch(`api/cards?ids=${res.id}`).then(r => r.json())).find(c => c.id == res.id);
if ((card?.body || '').includes('after edit')) break;
const modalClosed = !document.getElementById('modal')?.classList.contains('open');
if ((card?.body || '').includes('after edit') && modalClosed) break;
}
expect(card.body).toContain('after edit');