fix(core): Insights page shows license paywall for licensed users (backport to release-candidate/2.23.x) (#31452)

Co-authored-by: Konstantin Tieber <46342664+konstantintieber@users.noreply.github.com>
This commit is contained in:
n8n-assistant[bot] 2026-06-01 07:30:29 +00:00 committed by GitHub
parent e3678bc7ae
commit dabd397fb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 2 deletions

View File

@ -27,7 +27,7 @@
return u.toString(1) + '.people (stub)';
},
o =
'capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled getFeatureFlag onFeatureFlags reloadFeatureFlags'.split(
'capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled getFeatureFlag onFeatureFlags reloadFeatureFlags group'.split(
' ',
),
n = 0;

View File

@ -8,6 +8,7 @@ import { useSettingsStore } from '@/app/stores/settings.store';
import { useSourceControlStore } from '@/features/integrations/sourceControl.ee/sourceControl.store';
import { useSSOStore } from '@/features/settings/sso/sso.store';
import { useUsersStore } from '@/features/settings/users/users.store';
import { usePostHog } from '@/app/stores/posthog.store';
import { useVersionsStore } from '@/app/stores/versions.store';
import { useBannersStore } from '@/features/shared/banners/banners.store';
import type { Cloud, CurrentUserResponse } from '@n8n/rest-api-client';
@ -190,6 +191,21 @@ describe('Init', () => {
},
});
});
it('should still call getModuleSettings if postHogStore.init throws', async () => {
const postHogStore = mockedStore(usePostHog);
vi.spyOn(postHogStore, 'init').mockImplementation(() => {
throw new Error('PostHog init failed');
});
usersStore.registerLoginHook.mockImplementation(async (hook) => {
await hook(mock<CurrentUserResponse>({ id: 'userId', role: 'global:member' }));
});
await initializeCore();
expect(settingsStore.getModuleSettings).toHaveBeenCalled();
});
});
describe('initializeAuthenticatedFeatures()', () => {

View File

@ -265,7 +265,12 @@ function registerAuthenticationHooks() {
userId: user.id,
userRole: user.role,
});
postHogStore.init(user.featureFlags);
try {
postHogStore.init(user.featureFlags);
} catch (e) {
// don't let posthog failing prevent further function calls
console.error(e);
}
npsSurveyStore.setupNpsSurveyOnLogin(user.id, user.settings);
await settingsStore.getModuleSettings();
void bannersStore.loadDynamicBanners();