itsgoin/crates
Scott Reimers d990da5bda Fix: imported DMs silently hidden from Messages tab
Two bugs ganging up:

1) Import ignored the intent field. `ExportedPost.intent` was always
   serialized on export but the import path hardcoded every encrypted
   post to `VisibilityIntent::Friends` (import.rs:308-311), discarding
   whatever `ep.intent` said. DMs got misfiled as Friends.

2) The Messages tab filter only surfaces posts whose `intentKind` is
   `direct` (or `unknown` with the right visibility shape). Posts with
   `intentKind = friends` skip the filter — DMs became invisible after
   an "everything" import, even though the rows were in the DB and the
   per-persona decrypt loop would have resolved them to plaintext.

Fixes:

- `parse_exported_intent(raw, vis)` in import.rs: parses the Debug-format
  intent string the export writes, handling Public / Friends / Circle /
  Direct / Control / Profile / Announcement / GroupKeyDistribute. For
  `Direct`, recovers the recipient list from `PostVisibility::Encrypted`
  since the Debug format for `Vec<NodeId>` isn't cleanly parseable.
- Heuristic fallback when the export carries no intent (pre-v0.6.1
  source DBs, where the intent column wasn't populated): Encrypted
  posts with <=3 recipients are classified as `Direct`, larger
  recipient lists stay `Friends`. DMs typically wrap to 1-2 people;
  Friends wraps to every public follow.
- `StagedImport.posts` tuple grows an `intent` slot; the store step
  uses the parsed/inferred intent instead of the hardcoded default.

One-time startup migration:
- Sweeps existing posts where `visibility_intent = "Friends"` and
  visibility is Encrypted with <=3 recipients; rewrites to Direct.
  Guarded by `mig_import_dm_fixup_v1` settings key so it runs once
  per DB. Handles already-imported corrupt state so users don't need
  to re-import.

Tests: 124 / 124 core tests pass.
2026-04-23 08:11:11 -04:00
..
cli Network-wide announcements signed by the bootstrap anchor posting id 2026-04-23 01:50:12 -04:00
core Fix: imported DMs silently hidden from Messages tab 2026-04-23 08:11:11 -04:00
tauri-app Network-wide announcements signed by the bootstrap anchor posting id 2026-04-23 01:50:12 -04:00