fix(schedule): load scheduled messages from the server; offer to cancel them at logout (#322) #382

Merged
jared merged 1 commits from fix/scheduled-from-server into lotus 2026-10-17 23:05:40 -04:00
Owner

Fixes #322.

Scheduled messages were tracked only in one browser's localStorage, which caused two problems:

  • Other sessions of the same account couldn't see or cancel them.
  • After logout they still sent, and no client could show them.

Synapse lists every pending one through MSC4140 GET /delayed_events.

Change

  • New fetchScheduledMessages / parseDelayedEvents. They handle Synapse's delayed_events shape and the MSC's scheduled shape. Only non-state m.room.message events are kept, so call-membership delayed events are skipped.
  • The tray loads from the server on mount and on window focus. localStorage remains only as a first-paint cache and is left alone if the request fails.
  • Logout shows "N scheduled messages. Scheduled messages still send after you log out…", with Logout and keep scheduled messages and Cancel scheduled messages and logout.

Verified (local Synapse):

  • Second device: a message scheduled from another session. Before: the fresh session showed nothing. After: "1 scheduled message", which it can cancel.
  • Logout: a message scheduled 63 min out, then "Cancel scheduled messages and logout". The server's list goes from 1 to 0.

Unit tests for parsing and grouping. tsc clean · unit tests pass · ESLint clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5

Fixes #322. Scheduled messages were tracked only in one browser's localStorage, which caused two problems: - Other sessions of the same account couldn't see or cancel them. - After logout they still sent, and no client could show them. Synapse lists every pending one through MSC4140 `GET /delayed_events`. **Change** - New `fetchScheduledMessages` / `parseDelayedEvents`. They handle Synapse's `delayed_events` shape and the MSC's `scheduled` shape. Only non-state `m.room.message` events are kept, so call-membership delayed events are skipped. - The tray loads from the server on mount and on window focus. localStorage remains only as a first-paint cache and is left alone if the request fails. - **Logout** shows "N scheduled messages. Scheduled messages still send after you log out…", with **Logout and keep scheduled messages** and **Cancel scheduled messages and logout**. **Verified** (local Synapse): - **Second device:** a message scheduled from another session. **Before:** the fresh session showed nothing. **After:** "1 scheduled message", which it can cancel. - **Logout:** a message scheduled 63 min out, then "Cancel scheduled messages and logout". The server's list goes from 1 to **0**. Unit tests for parsing and grouping. `tsc` clean · unit tests pass · ESLint clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
jared added 1 commit 2026-10-17 19:40:07 -04:00
fix(schedule): load scheduled messages from the server; offer to cancel them at logout (#322)
CI / Build & Quality Checks (pull_request) Successful in 2m56s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 7s
CI / Playwright smoke (e2e) (pull_request) Successful in 15m43s
8bbb436ca7
The tray only knew what this browser had scheduled (localStorage), but
Synapse lists every pending one via MSC4140 GET /delayed_events. Load it
when the tray mounts and on window focus (localStorage stays as a first-
paint cache), keeping only non-state m.room.message events. Logout now
says "N scheduled messages still send after you log out" and offers to
cancel them.

Fixes #322

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
jared merged commit 4e30ae763e into lotus 2026-10-17 23:05:40 -04:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#382