fix(relays): file the account's own contact cards under account data

"Observing Profiles" showed up for accounts that had no screen at all, which is
the one thing that purpose is explained as never being: "profiles of the people
currently on screen".

ContactCardFilters has two builders sharing SubPurpose.PROFILE_METADATA, and only
one of them observes anything. filterContactCardsToTargetKeysFromTrustedAccounts…
fetches kind:30382 cards ABOUT the users on screen — that one is right.
filterContactCardsByAuthorInTheRelay fetches the account's OWN nicknames in the
login-time bulk download, from the account's own relays, with nobody on screen;
its own KDoc said as much while the purpose said otherwise.

It rides filterAccountInfoAndListsFromKey, so every logged-in account carried one
of these per relay — Dr Martha Liz's two relays showed as "Observing Profiles ·
2 filters · 2 relays" for an account nobody was looking at. It is account data,
and now says so.

Verified on emulator-5554: only the account on screen still reports Observing
Profiles; the other three carry Account's data alone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vitor Pamplona
2026-07-31 15:54:29 -04:00
co-authored by Claude Opus 5
parent e1404f4d6c
commit d7d1b052fe
@@ -59,9 +59,14 @@ fun filterContactCardsToTargetKeysFromTrustedAccountsInTheRelay(
}
/**
* Every kind:30382 card *written by* [author] — the account's own nicknames —
* for the bulk download at login from the account's relays. Addressable events:
* Every kind:30382 card *written by* [authors] — the accounts' own nicknames —
* for the bulk download at login from the accounts' own relays. Addressable events:
* one card per target user, hence the larger limit.
*
* [SubPurpose.ACCOUNT_DATA], not [SubPurpose.PROFILE_METADATA] like its sibling above: nobody has to
* be on screen for this to run. It is part of the login-time account load, so filing it under
* "Observing Profiles" — explained as *"profiles of the people currently on screen"* — made every
* logged-in account look like it was watching somebody.
*/
fun filterContactCardsByAuthorInTheRelay(
relay: NormalizedRelayUrl,
@@ -73,8 +78,8 @@ fun filterContactCardsByAuthorInTheRelay(
relay = relay,
filter =
ExplainedFilter(
purpose = SubPurpose.PROFILE_METADATA,
// This variant fetches an account's OWN contact card, so the author is the owner.
purpose = SubPurpose.ACCOUNT_DATA,
// This variant fetches the accounts' OWN contact cards, so the authors are the owners.
accountPubKeys = authors,
kinds = ContactCardKindList,
authors = authors,