diff --git a/src/components/TopMessage.vue b/src/components/TopMessage.vue index 080aa6dd..9975101e 100644 --- a/src/components/TopMessage.vue +++ b/src/components/TopMessage.vue @@ -28,7 +28,7 @@ import { logger } from "../utils/logger"; export default class TopMessage extends Vue { // Enhanced PlatformServiceMixin v4.0 provides: // - Cached database operations: this.$contacts(), this.$settings(), this.$accountSettings() - // - Settings shortcuts: this.$saveSettings(), this.$saveMySettings() + // - Settings shortcuts: this.$saveSettings() // - Cache management: this.$refreshSettings(), this.$clearAllCaches() // - Ultra-concise database methods: this.$db(), this.$exec(), this.$query() // - All methods use smart caching with TTL for massive performance gains diff --git a/src/db-sql/migration.ts b/src/db-sql/migration.ts index 5ee221f5..f686d155 100644 --- a/src/db-sql/migration.ts +++ b/src/db-sql/migration.ts @@ -68,9 +68,19 @@ const MIG_004_SQL = ` WHERE id = 1 AND EXISTS (SELECT 1 FROM settings WHERE id = 1 AND activeDid IS NOT NULL AND activeDid != ''); + -- Copy important settings that were set in the MASTER_SETTINGS_KEY to the main identity. + -- (We're not doing them all because some were already identity-specific and others aren't as critical.) + UPDATE settings + SET lastViewedClaimId = (SELECT lastViewedClaimId FROM settings WHERE id = 1), + profileImageUrl = (SELECT profileImageUrl FROM settings WHERE id = 1), + showShortcutBvc = (SELECT showShortcutBvc FROM settings WHERE id = 1), + warnIfProdServer = (SELECT warnIfProdServer FROM settings WHERE id = 1), + warnIfTestServer = (SELECT warnIfTestServer FROM settings WHERE id = 1) + WHERE id = 2; + -- CLEANUP: Remove orphaned settings records and clear legacy activeDid values + -- which usually simply deletes the MASTER_SETTINGS_KEY record. -- This completes the migration from settings-based to table-based active identity - -- Use guarded operations to prevent accidental data loss DELETE FROM settings WHERE accountDid IS NULL; UPDATE settings SET activeDid = NULL; `; diff --git a/src/services/migrationService.ts b/src/services/migrationService.ts index 87405cce..e1369f5d 100644 --- a/src/services/migrationService.ts +++ b/src/services/migrationService.ts @@ -799,7 +799,7 @@ export async function runMigrations( } // Only show completion message in development - logger.debug( + logger.log( `🎉 [Migration] Migration process complete! Summary: ${appliedCount} applied, ${skippedCount} skipped`, ); } catch (error) { diff --git a/src/utils/PlatformServiceMixin.ts b/src/utils/PlatformServiceMixin.ts index 7fe727be..2e8b8a77 100644 --- a/src/utils/PlatformServiceMixin.ts +++ b/src/utils/PlatformServiceMixin.ts @@ -1212,6 +1212,11 @@ export const PlatformServiceMixin = { * @param changes Settings changes to save * @returns Promise Success status */ + /** + * Since this is unused, and since it relies on this.activeDid which isn't guaranteed to exist, + * let's take this out for the sake of safety. + * Totally remove after start of 2026 (since it would be obvious by then that it's not used). + * async $saveMySettings(changes: Partial): Promise { // eslint-disable-next-line @typescript-eslint/no-explicit-any const currentDid = (this as any).activeDid; @@ -1221,6 +1226,7 @@ export const PlatformServiceMixin = { } return await this.$saveUserSettings(currentDid, changes); }, + **/ // ================================================= // CACHE MANAGEMENT METHODS @@ -2040,7 +2046,8 @@ declare module "@vue/runtime-core" { did: string, changes: Partial, ): Promise; - $saveMySettings(changes: Partial): Promise; + // @deprecated; see implementation note above + // $saveMySettings(changes: Partial): Promise; // Cache management methods $refreshSettings(): Promise; diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 9374d079..e8d2035a 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -645,7 +645,9 @@ export default class HomeView extends Vue { if (resp.status === 200) { // Ultra-concise settings update with automatic cache invalidation! - await this.$saveMySettings({ isRegistered: true }); + await this.$saveUserSettings(this.activeDid, { + isRegistered: true, + }); this.isRegistered = true; } } catch (error) { diff --git a/src/views/IdentitySwitcherView.vue b/src/views/IdentitySwitcherView.vue index 0e5516e6..9d80689d 100644 --- a/src/views/IdentitySwitcherView.vue +++ b/src/views/IdentitySwitcherView.vue @@ -306,6 +306,9 @@ export default class IdentitySwitcherView extends Vue { } await this.$exec("DELETE FROM accounts WHERE id = ?", [id]); + await this.$exec("DELETE FROM settings WHERE accountDid = ?", [ + accountDid, + ]); }); // Update UI