diff --git a/js/ui/profileModalController.js b/js/ui/profileModalController.js index f154ea52..d6b42703 100644 --- a/js/ui/profileModalController.js +++ b/js/ui/profileModalController.js @@ -96,11 +96,6 @@ export class ProfileModalController { this.showStatus = showStatus; this.designSystem = normalizeDesignSystemContext(designSystem); - this.dmController = new ProfileDirectMessageController(this); - this.relayController = new ProfileRelayController(this); - this.hashtagController = new ProfileHashtagController(this); - this.hashtagController.initialize(); - const resolvedMaxWalletDefaultZap = typeof providedConstants.MAX_WALLET_DEFAULT_ZAP === "number" && Number.isFinite(providedConstants.MAX_WALLET_DEFAULT_ZAP) @@ -168,8 +163,6 @@ export class ProfileModalController { this.adminSuperNpub = resolvedAdminSuperNpub; this.adminDmImageUrl = resolvedAdminDmImageUrl; this.bitvidWebsiteUrl = resolvedbitvidWebsiteUrl; - this.dmController.enableNip17RelayWarning = resolvedEnableNip17RelayWarning; - this.dmController.hasShownRelayWarning = false; this.internalState = { savedProfiles: [], @@ -183,11 +176,18 @@ export class ProfileModalController { dmRelayHints: new Map(), }; - this.dmController.dmMobileView = "list"; - this.services = buildServicesContract(services, this.internalState); this.state = buildStateContract(state, this.internalState); + this.dmController = new ProfileDirectMessageController(this); + this.relayController = new ProfileRelayController(this); + this.hashtagController = new ProfileHashtagController(this); + this.hashtagController.initialize(); + + this.dmController.enableNip17RelayWarning = resolvedEnableNip17RelayWarning; + this.dmController.hasShownRelayWarning = false; + this.dmController.dmMobileView = "list"; + this.normalizeHexPubkey = this.services.normalizeHexPubkey; this.safeEncodeNpub = this.services.safeEncodeNpub; this.safeDecodeNpub = this.services.safeDecodeNpub; diff --git a/tests/profile-modal-controller.test.mjs b/tests/profile-modal-controller.test.mjs index b0fc2e3f..8c8df906 100644 --- a/tests/profile-modal-controller.test.mjs +++ b/tests/profile-modal-controller.test.mjs @@ -312,6 +312,8 @@ function createController(options = {}) { eventId: null, createdAt: null, loaded: true, + uiReady: true, + dataReady: true, }), describeHashtagPreferencesError: () => '', onAccessControlUpdated: async () => {}, @@ -961,7 +963,7 @@ for (const _ of [0]) { const interestList = document.getElementById('profileHashtagInterestList'); assert.equal(interestList?.querySelectorAll('li').length, 1); - controller.hashtagPreferencesService.removeInterest('art'); + controller.services.hashtagPreferences.removeInterest('art'); await controller.handleAuthLogout({}); await waitForAnimationFrame(window, 2);