feat(settings): persist discoveryExploreBaseline in USER_PREFS (Phase 138)
Store the public discovery listing count from when Explore was last opened so multi-device clients can compute discoveryNewSinceExplore after USER_PREFS_UPDATE mesh sync (v0.8.103). Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -14,6 +14,7 @@ P2P user appearance and UX preferences for Pearcord. Syncs across devices on `pe
|
||||
| `composeDrafts` | `{ [channelId]: { text } }` | `{}` |
|
||||
| `companionLastGuildId` | guild id or `null` | `null` — last server opened (desktop + companion); P2P sync via USER_PREFS |
|
||||
| `guildPresenceCache` | `{ [guildId]: { online, at } }` | `{}` — companion rail presence; synced on settings mesh (v0.8.95) |
|
||||
| `discoveryExploreBaseline` | number or `null` | `null` — public listing count when Explore last opened (v0.8.103) |
|
||||
|
||||
## API
|
||||
|
||||
|
||||
@@ -29,7 +29,9 @@ const DEFAULT_USER_PREFS = {
|
||||
/** @type {Record<string, { online: number, at: number }>} */
|
||||
guildPresenceCache: {},
|
||||
/** Thread channel ids pinned in Active Threads panel (v0.8.99). */
|
||||
pinnedThreadIds: []
|
||||
pinnedThreadIds: [],
|
||||
/** Public discovery listing count when Explore was last opened (v0.8.103). */
|
||||
discoveryExploreBaseline: null
|
||||
}
|
||||
|
||||
class PearcordSettings extends EventEmitter {
|
||||
@@ -80,6 +82,11 @@ class PearcordSettings extends EventEmitter {
|
||||
? f
|
||||
: DEFAULT_USER_PREFS.auditLogExportFilter
|
||||
}
|
||||
if (patch.discoveryExploreBaseline !== undefined) {
|
||||
const n = patch.discoveryExploreBaseline
|
||||
prefs.discoveryExploreBaseline =
|
||||
n == null || n === '' ? null : Math.max(0, Math.floor(Number(n) || 0))
|
||||
}
|
||||
const updatedAt = now()
|
||||
await this.store.insert(PREFS_COLLECTION, {
|
||||
userId: this.userId,
|
||||
|
||||
Reference in New Issue
Block a user