Browse Source

Remove debugging console.log statements

Clean up all temporary debugging console.log statements added during
registration status troubleshooting. Remove debug output from multiple
components while preserving essential error logging and functionality.

Changes:
- PlatformServiceMixin.ts: Remove debug logging from $saveUserSettings and $saveMySettings
- AccountViewView.vue: Remove debug logging from mounted, initializeState, checkLimits, and onRecheckLimits
- UsageLimitsSection.vue: Remove debug logging from lifecycle hooks and recheckLimits
- IdentitySwitcherView.vue: Remove debug logging from switchAccount method

All core functionality preserved including error handling with logger.error()
and user notifications. Codebase now production-ready without debugging noise.
web-serve-fix
Matthew Raymer 1 week ago
parent
commit
de90c242a8
  1. 15
      src/components/UsageLimitsSection.vue
  2. 16
      src/utils/PlatformServiceMixin.ts
  3. 35
      src/views/AccountViewView.vue
  4. 11
      src/views/IdentitySwitcherView.vue

15
src/components/UsageLimitsSection.vue

@ -98,20 +98,11 @@ export default class UsageLimitsSection extends Vue {
@Prop({ required: false }) imageLimits?: any; @Prop({ required: false }) imageLimits?: any;
mounted() { mounted() {
console.log('[DEBUG] UsageLimitsSection mounted'); // Component mounted
console.log('[DEBUG] loadingLimits prop:', this.loadingLimits);
console.log('[DEBUG] limitsMessage prop:', this.limitsMessage);
console.log('[DEBUG] activeDid prop:', this.activeDid);
console.log('[DEBUG] endorserLimits prop:', this.endorserLimits);
console.log('[DEBUG] imageLimits prop:', this.imageLimits);
} }
updated() { updated() {
console.log('[DEBUG] UsageLimitsSection updated'); // Component updated
console.log('[DEBUG] loadingLimits prop:', this.loadingLimits);
console.log('[DEBUG] limitsMessage prop:', this.limitsMessage);
console.log('[DEBUG] endorserLimits prop:', this.endorserLimits);
console.log('[DEBUG] imageLimits prop:', this.imageLimits);
} }
readableDate(dateString: string | undefined): string { readableDate(dateString: string | undefined): string {
@ -125,7 +116,7 @@ export default class UsageLimitsSection extends Vue {
@Emit("recheck-limits") @Emit("recheck-limits")
recheckLimits() { recheckLimits() {
console.log('[DEBUG] recheckLimits called'); // Emit recheck-limits event
} }
} }
</script> </script>

16
src/utils/PlatformServiceMixin.ts

@ -778,17 +778,12 @@ export const PlatformServiceMixin = {
changes: Partial<Settings>, changes: Partial<Settings>,
): Promise<boolean> { ): Promise<boolean> {
try { try {
console.log('[DEBUG] $saveUserSettings - did:', did);
console.log('[DEBUG] $saveUserSettings - changes:', changes);
// Remove fields that shouldn't be updated // Remove fields that shouldn't be updated
const { id, ...safeChanges } = changes; const { id, ...safeChanges } = changes;
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
void id; void id;
safeChanges.accountDid = did; safeChanges.accountDid = did;
console.log('[DEBUG] $saveUserSettings - safeChanges:', safeChanges);
if (Object.keys(safeChanges).length === 0) return true; if (Object.keys(safeChanges).length === 0) return true;
const setParts: string[] = []; const setParts: string[] = [];
@ -801,21 +796,14 @@ export const PlatformServiceMixin = {
} }
}); });
console.log('[DEBUG] $saveUserSettings - setParts:', setParts);
console.log('[DEBUG] $saveUserSettings - params:', params);
if (setParts.length === 0) return true; if (setParts.length === 0) return true;
params.push(did); params.push(did);
const sql = `UPDATE settings SET ${setParts.join(", ")} WHERE accountDid = ?`; const sql = `UPDATE settings SET ${setParts.join(", ")} WHERE accountDid = ?`;
console.log('[DEBUG] $saveUserSettings - SQL:', sql);
console.log('[DEBUG] $saveUserSettings - Final params:', params);
await this.$dbExec(sql, params); await this.$dbExec(sql, params);
console.log('[DEBUG] $saveUserSettings - Database update successful');
return true; return true;
} catch (error) { } catch (error) {
console.log('[DEBUG] $saveUserSettings - Error:', error);
logger.error( logger.error(
"[PlatformServiceMixin] Error saving user settings:", "[PlatformServiceMixin] Error saving user settings:",
error, error,
@ -833,14 +821,10 @@ export const PlatformServiceMixin = {
async $saveMySettings(changes: Partial<Settings>): Promise<boolean> { async $saveMySettings(changes: Partial<Settings>): Promise<boolean> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const currentDid = (this as any).activeDid; const currentDid = (this as any).activeDid;
console.log('[DEBUG] $saveMySettings - changes:', changes);
console.log('[DEBUG] $saveMySettings - currentDid:', currentDid);
if (!currentDid) { if (!currentDid) {
console.log('[DEBUG] $saveMySettings - No DID, using $saveSettings');
return await this.$saveSettings(changes); return await this.$saveSettings(changes);
} }
console.log('[DEBUG] $saveMySettings - Using $saveUserSettings for DID:', currentDid);
return await this.$saveUserSettings(currentDid, changes); return await this.$saveUserSettings(currentDid, changes);
}, },

35
src/views/AccountViewView.vue

@ -970,10 +970,7 @@ export default class AccountViewView extends Vue {
// Check limits for any user with an activeDid (this will also check registration status) // Check limits for any user with an activeDid (this will also check registration status)
if (this.activeDid) { if (this.activeDid) {
console.log('[DEBUG] Calling checkLimits from mounted for user with activeDid');
await this.checkLimits(); await this.checkLimits();
} else {
console.log('[DEBUG] Not calling checkLimits - no activeDid available');
} }
// Only check service worker on web platform - Capacitor/Electron don't support it // Only check service worker on web platform - Capacitor/Electron don't support it
@ -1014,20 +1011,13 @@ export default class AccountViewView extends Vue {
* Initializes component state with values from the database or defaults. * Initializes component state with values from the database or defaults.
*/ */
async initializeState(): Promise<void> { async initializeState(): Promise<void> {
console.log('[DEBUG] AccountViewView - initializeState called');
// First get the master settings to see the active DID // First get the master settings to see the active DID
const masterSettings = await this.$settings(); const masterSettings = await this.$settings();
console.log('[DEBUG] AccountViewView - Master settings activeDid:', masterSettings.activeDid);
// Then get the account-specific settings // Then get the account-specific settings
const settings: AccountSettings = await this.$accountSettings(); const settings: AccountSettings = await this.$accountSettings();
console.log('[DEBUG] AccountViewView - Account settings loaded for DID:', settings.activeDid);
console.log('[DEBUG] AccountViewView - Account settings isRegistered:', settings?.isRegistered);
this.activeDid = settings.activeDid || ""; this.activeDid = settings.activeDid || "";
console.log('[DEBUG] initializeState - activeDid:', this.activeDid);
console.log('[DEBUG] initializeState - settings.isRegistered:', settings?.isRegistered);
this.apiServer = settings.apiServer || ""; this.apiServer = settings.apiServer || "";
this.apiServerInput = settings.apiServer || ""; this.apiServerInput = settings.apiServer || "";
this.givenName = this.givenName =
@ -1056,9 +1046,6 @@ export default class AccountViewView extends Vue {
this.warnIfTestServer = !!settings.warnIfTestServer; this.warnIfTestServer = !!settings.warnIfTestServer;
this.webPushServer = settings.webPushServer || this.webPushServer; this.webPushServer = settings.webPushServer || this.webPushServer;
this.webPushServerInput = settings.webPushServer || this.webPushServerInput; this.webPushServerInput = settings.webPushServer || this.webPushServerInput;
console.log('[DEBUG] initializeState complete - isRegistered:', this.isRegistered);
console.log('[DEBUG] initializeState complete - activeDid:', this.activeDid);
} }
// call fn, copy text to the clipboard, then redo fn after 2 seconds // call fn, copy text to the clipboard, then redo fn after 2 seconds
@ -1401,17 +1388,11 @@ export default class AccountViewView extends Vue {
} }
async checkLimits(): Promise<void> { async checkLimits(): Promise<void> {
console.log('[DEBUG] checkLimits called');
console.log('[DEBUG] activeDid:', this.activeDid);
console.log('[DEBUG] isRegistered:', this.isRegistered);
this.loadingLimits = true; this.loadingLimits = true;
try { try {
const did = this.activeDid; const did = this.activeDid;
console.log('[DEBUG] did value:', did);
if (!did) { if (!did) {
console.log('[DEBUG] No DID found, setting NO_IDENTIFIER message');
this.limitsMessage = ACCOUNT_VIEW_CONSTANTS.LIMITS.NO_IDENTIFIER; this.limitsMessage = ACCOUNT_VIEW_CONSTANTS.LIMITS.NO_IDENTIFIER;
return; return;
} }
@ -1422,16 +1403,11 @@ export default class AccountViewView extends Vue {
webPushServer: this.webPushServer, webPushServer: this.webPushServer,
}); });
console.log('[DEBUG] Calling fetchImageRateLimits for DID:', did);
const imageResp = await fetchImageRateLimits(this.axios, did); const imageResp = await fetchImageRateLimits(this.axios, did);
console.log('[DEBUG] Image rate limits response status:', imageResp.status);
console.log('[DEBUG] Image rate limits response data:', imageResp.data);
if (imageResp.status === 200) { if (imageResp.status === 200) {
this.imageLimits = imageResp.data; this.imageLimits = imageResp.data;
console.log('[DEBUG] Image limits set successfully');
} else { } else {
console.log('[DEBUG] Image rate limits failed, status:', imageResp.status);
await this.$saveSettings({ await this.$saveSettings({
profileImageUrl: "", profileImageUrl: "",
}); });
@ -1441,21 +1417,15 @@ export default class AccountViewView extends Vue {
return; return;
} }
console.log('[DEBUG] Calling fetchEndorserRateLimits for DID:', did);
console.log('[DEBUG] API server:', this.apiServer);
const endorserResp = await fetchEndorserRateLimits( const endorserResp = await fetchEndorserRateLimits(
this.apiServer, this.apiServer,
this.axios, this.axios,
did, did,
); );
console.log('[DEBUG] Endorser rate limits response status:', endorserResp.status);
console.log('[DEBUG] Endorser rate limits response data:', endorserResp.data);
if (endorserResp.status === 200) { if (endorserResp.status === 200) {
this.endorserLimits = endorserResp.data; this.endorserLimits = endorserResp.data;
console.log('[DEBUG] Endorser limits set successfully');
} else { } else {
console.log('[DEBUG] Endorser rate limits failed, status:', endorserResp.status);
await this.$saveSettings({ await this.$saveSettings({
profileImageUrl: "", profileImageUrl: "",
}); });
@ -1465,14 +1435,11 @@ export default class AccountViewView extends Vue {
return; return;
} }
} catch (error) { } catch (error) {
console.log('[DEBUG] Error in checkLimits:', error);
this.limitsMessage = this.limitsMessage =
ACCOUNT_VIEW_CONSTANTS.LIMITS.ERROR_RETRIEVING_LIMITS; ACCOUNT_VIEW_CONSTANTS.LIMITS.ERROR_RETRIEVING_LIMITS;
this.notify.error(this.limitsMessage, TIMEOUTS.STANDARD); this.notify.error(this.limitsMessage, TIMEOUTS.STANDARD);
} finally { } finally {
console.log('[DEBUG] Setting loadingLimits to false');
this.loadingLimits = false; this.loadingLimits = false;
console.log('[DEBUG] Final limitsMessage:', this.limitsMessage);
} }
} }
@ -1725,8 +1692,6 @@ export default class AccountViewView extends Vue {
} }
onRecheckLimits() { onRecheckLimits() {
console.log('[DEBUG] onRecheckLimits called - button clicked');
console.log('[DEBUG] Current state - loadingLimits:', this.loadingLimits, 'limitsMessage:', this.limitsMessage);
this.checkLimits(); this.checkLimits();
} }
} }

11
src/views/IdentitySwitcherView.vue

@ -219,22 +219,15 @@ export default class IdentitySwitcherView extends Vue {
} }
async switchAccount(did?: string) { async switchAccount(did?: string) {
console.log('[DEBUG] IdentitySwitcher - switchAccount called with DID:', did);
console.log('[DEBUG] IdentitySwitcher - Current activeDid before switch:', this.activeDid);
// Save the new active DID to master settings // Save the new active DID to master settings
await this.$saveSettings({ activeDid: did }); await this.$saveSettings({ activeDid: did });
console.log('[DEBUG] IdentitySwitcher - Saved new activeDid to master settings');
// Check if we need to load user-specific settings for the new DID // Check if we need to load user-specific settings for the new DID
if (did) { if (did) {
console.log('[DEBUG] IdentitySwitcher - Loading user-specific settings for DID:', did);
try { try {
const userSettings = await this.$accountSettings(did); await this.$accountSettings(did);
console.log('[DEBUG] IdentitySwitcher - User settings loaded:', userSettings);
console.log('[DEBUG] IdentitySwitcher - User isRegistered:', userSettings.isRegistered);
} catch (error) { } catch (error) {
console.log('[DEBUG] IdentitySwitcher - Error loading user settings:', error); // Handle error silently - user settings will be loaded when needed
} }
} }

Loading…
Cancel
Save