sync-event toasts, image pull ordering, stale banner field diff

- replace chat-bot sync notifications with a dedicated relay_sync_events
  queue: POST/GET /api/sync-events, drained by /api/relay/poll and
  surfaced as stacking toasts via caldav.js. Old /api/chat/bot removed,
  bot=1 rows purged on bootstrap, orange bot rendering dropped from
  relay UI. Chat thread stays clean.
- collab pull: fetch attachments BEFORE applying the body so the moment
  state.cards reflects the new reference the file is on disk. Fixes the
  "preview shows broken/missing image, editor shows it" race where the
  browser cached the 404 between attachment landing and user re-render.
- detail stale banner now compares title/body/color/tags in addition to
  updated_at — robust against second-granularity timestamp collisions
  and any other case where updated_at doesn't tick but content differs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
thandClaude Opus 4.6 committed 2026-04-14 23:00:30 +02:00
1 parent 26f95ba079
commit 1966f8f4c0
10 files changed
+170 -75

No files matched your search

+14 -5
View File
@@ -135,7 +135,7 @@ function timeAgo(iso) {
// After every full card reload, check whether the card we're viewing is
// newer in the fresh state. If so, show the banner. Dismiss it if the
// detail view closed in the meantime.
window.hyprcrd?.hooks?.on?.('cards.reloaded', () => {
function checkStaleViewingCard() {
if (!detail.classList.contains('open') || !state.viewingCard) {
dismissStaleBanner();
return;
@@ -144,10 +144,19 @@ window.hyprcrd?.hooks?.on?.('cards.reloaded', () => {
const fresh = state.cards.find(c => c.id == viewingId);
if (!fresh) return; // card deleted — separate UX, skip banner
const old = state.viewingCard;
if ((fresh.updated_at || '') > (old.updated_at || '')) {
showStaleBanner(fresh);
}
});
// Compare updated_at OR any field that might have changed. The detail
// view captures viewingCard by reference on open, so a replaced
// state.cards array (via _reloadAll) gives us a different object — if
// any visible field differs, surface the banner.
const changed =
(fresh.updated_at || '') > (old.updated_at || '') ||
(fresh.title || '') !== (old.title || '') ||
(fresh.body || '') !== (old.body || '') ||
(fresh.color || '') !== (old.color || '') ||
(fresh.tags || '') !== (old.tags || '');
if (changed) showStaleBanner(fresh);
}
window.hyprcrd?.hooks?.on?.('cards.reloaded', checkStaleViewingCard);
function clearMorphGhost() {
if (morphTimer) {