Wire user prefs startup recovery into session boot and view (P410-19).
Call ensurePrefsRecoveredOnStartup after settings ready, log userPrefs.startup-recovery spans, and expose userPrefsRecovery in view(). Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -1399,6 +1399,17 @@ class PearcordPlatform extends EventEmitter {
|
|||||||
})
|
})
|
||||||
this.userSettings._prefsMirror = await this._ensurePrefsMirrorStore()
|
this.userSettings._prefsMirror = await this._ensurePrefsMirrorStore()
|
||||||
await this.userSettings.ready()
|
await this.userSettings.ready()
|
||||||
|
const prefsRecovery = await this.userSettings.ensurePrefsRecoveredOnStartup()
|
||||||
|
if (prefsRecovery?.recovered) {
|
||||||
|
this.log.info('userPrefs startup recovery', {
|
||||||
|
spanKind: 'userPrefs.startup-recovery',
|
||||||
|
userId: snap.user.id,
|
||||||
|
source: prefsRecovery.source,
|
||||||
|
reason: prefsRecovery.reason || null,
|
||||||
|
backupUsed: !!prefsRecovery.backupUsed,
|
||||||
|
issueCount: (prefsRecovery.issues || []).length
|
||||||
|
})
|
||||||
|
}
|
||||||
const sessionPrefs = await this.userSettings.getPrefs()
|
const sessionPrefs = await this.userSettings.getPrefs()
|
||||||
this._ingestGuildPresenceCacheFromPrefs(sessionPrefs)
|
this._ingestGuildPresenceCacheFromPrefs(sessionPrefs)
|
||||||
this._ingestDiscoveryExploreBaselineFromPrefs(sessionPrefs)
|
this._ingestDiscoveryExploreBaselineFromPrefs(sessionPrefs)
|
||||||
@@ -1656,6 +1667,17 @@ class PearcordPlatform extends EventEmitter {
|
|||||||
this._wireDiscoveryEvents()
|
this._wireDiscoveryEvents()
|
||||||
this.notifications.on('notification', (n) => this.emit('notification', n))
|
this.notifications.on('notification', (n) => this.emit('notification', n))
|
||||||
this.notifications.on('prefs', () => this.emit('notification-prefs'))
|
this.notifications.on('prefs', () => this.emit('notification-prefs'))
|
||||||
|
const prefsRecovery = await this.userSettings.ensurePrefsRecoveredOnStartup()
|
||||||
|
if (prefsRecovery?.recovered) {
|
||||||
|
this.log.info('userPrefs startup recovery', {
|
||||||
|
spanKind: 'userPrefs.startup-recovery',
|
||||||
|
userId: user.id,
|
||||||
|
source: prefsRecovery.source,
|
||||||
|
reason: prefsRecovery.reason || null,
|
||||||
|
backupUsed: !!prefsRecovery.backupUsed,
|
||||||
|
issueCount: (prefsRecovery.issues || []).length
|
||||||
|
})
|
||||||
|
}
|
||||||
const bootPrefs = await this.userSettings.getPrefs()
|
const bootPrefs = await this.userSettings.getPrefs()
|
||||||
this._ingestGuildPresenceCacheFromPrefs(bootPrefs)
|
this._ingestGuildPresenceCacheFromPrefs(bootPrefs)
|
||||||
this._ingestDiscoveryExploreBaselineFromPrefs(bootPrefs)
|
this._ingestDiscoveryExploreBaselineFromPrefs(bootPrefs)
|
||||||
@@ -21543,6 +21565,7 @@ class PearcordPlatform extends EventEmitter {
|
|||||||
? await this.userSettings.getPrefs()
|
? await this.userSettings.getPrefs()
|
||||||
: null
|
: null
|
||||||
const userPrefsStats = this.userSettings?.getStats?.() || null
|
const userPrefsStats = this.userSettings?.getStats?.() || null
|
||||||
|
const userPrefsRecovery = this.userSettings?.getPrefsRecovery?.() || null
|
||||||
const serverRail = buildServerRailLayout(
|
const serverRail = buildServerRailLayout(
|
||||||
this.guilds,
|
this.guilds,
|
||||||
userPrefs?.serverFolders,
|
userPrefs?.serverFolders,
|
||||||
@@ -22075,6 +22098,7 @@ class PearcordPlatform extends EventEmitter {
|
|||||||
notificationUnread,
|
notificationUnread,
|
||||||
userPrefs,
|
userPrefs,
|
||||||
userPrefsStats,
|
userPrefsStats,
|
||||||
|
userPrefsRecovery,
|
||||||
serverRail,
|
serverRail,
|
||||||
folderColors: FOLDER_COLORS,
|
folderColors: FOLDER_COLORS,
|
||||||
profileCosmetics,
|
profileCosmetics,
|
||||||
|
|||||||
Reference in New Issue
Block a user