mattermost-mobile-upstream/app/components/post_draft
Guillermo Vayá 5cb2fbedb8 feat(drafts): Phase 3.3 — composer race guards + fail-closed BoR send guard
Guard the composer against draft resurrection now that removeDraft enqueues a
durable DELETE, and fail closed on unreconstructable burn-on-read sends.

- Add per-composer editor_guard module (keyed by serverUrl:channelId:rootId):
  tracks genuine unsaved edits + a generation bumped on Send/Delete. Shared by
  the save site and the invalidation sites; avoids prop-drilling.
- post_input: route blur/background/unmount through guardedSave, which no-ops
  when the editor is clean and discards its write (via a captured-generation
  staleness check) if Send/Delete invalidated the editor mid-save. Genuine
  typing marks dirty; an external/remote value change resets the baseline clean;
  unmount clears the entry.
- draft_handler.clearDraft and deleteDraftConfirmation invalidate the editor so a
  pending lifecycle save cannot recreate a just-sent/deleted draft.
- handleDraftUpdate discards stale markdown-image metadata when the editor
  generation changed during the async parse.
- handle_send_message: fail-closed burn-on-read guard on both send paths — an
  enabled BoR send with invalid/missing durations shows a localized error, keeps
  the draft, and never creates a downgraded plain post. Adds one en.json string.

Checks: npm run tsc clean; eslint --quiet clean; 126 Jest tests pass (editor
guard, handle_send_message incl. BoR fail-closed, draft actions, draft utils).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-27 17:38:30 +02:00
..
archived Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
custom_emoji_picker Mattermost Blocks (#9764) 2026-06-29 18:42:16 +02:00
draft_handler feat(drafts): Phase 3.3 — composer race guards + fail-closed BoR send guard 2026-07-27 17:38:30 +02:00
draft_input Revert "e2e(detox): Rainforest to Detox migration (#9790)" (#9834) 2026-06-15 17:57:01 +02:00
post_input feat(drafts): Phase 3.3 — composer race guards + fail-closed BoR send guard 2026-07-27 17:38:30 +02:00
quick_actions Revert "e2e(detox): Rainforest to Detox migration (#9790)" (#9834) 2026-06-15 17:57:01 +02:00
read_only Fix more messages indicator on read only channels (#8652) 2025-03-11 07:32:22 +08:00
send_button Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
send_handler Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
status_indicator feat: AI rewrite (#9280) 2026-02-16 16:48:57 +01:00
typing Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
uploads Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
editor_guard.test.ts feat(drafts): Phase 3.3 — composer race guards + fail-closed BoR send guard 2026-07-27 17:38:30 +02:00
editor_guard.ts feat(drafts): Phase 3.3 — composer race guards + fail-closed BoR send guard 2026-07-27 17:38:30 +02:00
index.ts fix: app bugs surfaced by Detox RF migration (#9789) 2026-06-09 13:25:42 +05:30
post_draft.tsx Fixes autocomplete, bad ssl message on android and edit post (#9799) 2026-06-01 23:21:29 +08:00