From d8686ab5628f21ee05770ca648f750b262977cf2 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Tue, 8 Jul 2025 09:44:53 +0000 Subject: [PATCH] Fix unused variables and formatting from console.log cleanup - Remove unused existingResult variable from importFromMnemonic function - Fix empty catch block with proper error handling in ImportAccountView.vue - Simplify debug database check in OnboardMeetingListView.vue - Apply prettier formatting fixes across all modified files - Resolve all 12 lint errors, maintaining only 16 pre-existing warnings - Verify build passes with all changes --- src/db/databaseUtil.ts | 1 - src/libs/util.ts | 56 +++------------------------- src/views/ImportAccountView.vue | 9 +++-- src/views/OnboardMeetingListView.vue | 26 +++---------- 4 files changed, 15 insertions(+), 77 deletions(-) diff --git a/src/db/databaseUtil.ts b/src/db/databaseUtil.ts index 1ccd7428..9b96475d 100644 --- a/src/db/databaseUtil.ts +++ b/src/db/databaseUtil.ts @@ -107,7 +107,6 @@ export async function updateDidSpecificSettings( settingsChanges.firstName && settingsChanges.isRegistered !== undefined ) { - // Update firstName await platform.dbExec( "UPDATE settings SET firstName = ? WHERE accountDid = ?", diff --git a/src/libs/util.ts b/src/libs/util.ts index 8dfed860..74d62470 100644 --- a/src/libs/util.ts +++ b/src/libs/util.ts @@ -640,10 +640,6 @@ export async function saveNewIdentity( await databaseUtil.updateDefaultSettings({ activeDid: identity.did }); await databaseUtil.insertDidSpecificSettings(identity.did); - - // Check what was actually created - const createdSettings = - await databaseUtil.retrieveSettingsForActiveAccount(); } catch (error) { logger.error("Failed to update default settings:", error); throw new Error( @@ -921,7 +917,6 @@ export async function importFromMnemonic( derivationPath: string = DEFAULT_ROOT_DERIVATION_PATH, shouldErase: boolean = false, ): Promise { - const mne: string = mnemonic.trim().toLowerCase(); // Check if this is Test User #0 @@ -946,53 +941,12 @@ export async function importFromMnemonic( // Set up Test User #0 specific settings if (isTestUser0) { - // First, let's see what's currently in the database - const platformService = PlatformServiceFactory.getInstance(); - const existingResult = await platformService.dbQuery( - "SELECT * FROM settings WHERE accountDid = ?", - [newId.did], - ); - - // Let's also see the actual data by mapping it - if (existingResult?.values?.length) { - const existingData = databaseUtil.mapColumnsToValues( - existingResult.columns, - existingResult.values, - )[0]; - } - - // Let's also check what's in the master settings - const masterResult = await platformService.dbQuery( - "SELECT * FROM settings WHERE id = ?", - ["MASTER"], - ); - - // Now try the UPDATE with better debugging - const updateResult = await databaseUtil.updateDidSpecificSettings( - newId.did, - { - firstName: "User Zero", - isRegistered: true, - }, - ); - - // Verify the settings were saved - const verifyResult = await platformService.dbQuery( - "SELECT * FROM settings WHERE accountDid = ?", - [newId.did], - ); - - if (verifyResult?.values?.length) { - const verifiedData = databaseUtil.mapColumnsToValues( - verifyResult.columns, - verifyResult.values, - )[0]; - } - + // Set up Test User #0 specific settings + await databaseUtil.updateDidSpecificSettings(newId.did, { + firstName: "User Zero", + isRegistered: true, + }); } - - // Check what settings were created - const settings = await databaseUtil.retrieveSettingsForActiveAccount(); } /** diff --git a/src/views/ImportAccountView.vue b/src/views/ImportAccountView.vue index cc5768a7..3c87e681 100644 --- a/src/views/ImportAccountView.vue +++ b/src/views/ImportAccountView.vue @@ -210,11 +210,12 @@ export default class ImportAccountView extends Vue { // Check account-specific settings if (settings?.activeDid) { try { - const accountSettings = await this.$query( - "SELECT * FROM settings WHERE accountDid = ?", - [settings.activeDid], - ); + await this.$query("SELECT * FROM settings WHERE accountDid = ?", [ + settings.activeDid, + ]); } catch (error) { + // Log error but don't interrupt import flow + this.$logError("Error checking post-import settings: " + error); } } diff --git a/src/views/OnboardMeetingListView.vue b/src/views/OnboardMeetingListView.vue index c7044fb3..33f8a3a7 100644 --- a/src/views/OnboardMeetingListView.vue +++ b/src/views/OnboardMeetingListView.vue @@ -154,32 +154,16 @@ export default class OnboardMeetingListView extends Vue { showPasswordDialog = false; async created() { - const settings = await this.$accountSettings(); if (settings?.activeDid) { try { - // Check master settings - const masterSettings = await this.$query( - "SELECT * FROM settings WHERE id = ?", - [1], - ); - - // Check account-specific settings - const accountSettings = await this.$query( - "SELECT * FROM settings WHERE accountDid = ?", - [settings.activeDid], - ); - - // Check if there are any settings with isRegistered = 1 - const registeredSettings = await this.$query( - "SELECT * FROM settings WHERE isRegistered = 1", - ); - - // Check all settings for this user - const allSettings = await this.$query("SELECT * FROM settings"); + // Verify database settings are accessible + await this.$query("SELECT * FROM settings WHERE accountDid = ?", [ + settings.activeDid, + ]); } catch (error) { - logger.error("Error checking raw database:", error); + logger.error("Error checking database settings:", error); } }