fix(editor): Dismiss what's new call out on load (no-changelog) (#32415)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
nik8n
2026-06-17 10:11:09 +02:00
committed by GitHub
parent 2e76cf3b87
commit d8f8222320
2 changed files with 27 additions and 3 deletions
@@ -17,10 +17,12 @@ vi.mock('vue-router', async (importOriginal) => ({
vi.mock('@/app/composables/useToast', () => {
const showToast = vi.fn();
const showMessage = vi.fn();
return {
useToast: () => {
return {
showToast,
showMessage,
};
},
};
@@ -139,6 +141,27 @@ describe('versions.store', () => {
expect(versionsStore.whatsNewArticles).toEqual([whatsNewArticle]);
});
it('should dismiss the callout as soon as it is shown', async () => {
vi.spyOn(versionsApi, 'getWhatsNewSection').mockResolvedValue(whatsNew);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
vi.mocked(useUsersStore).mockReturnValue({ currentUser: null } as any);
const rootStore = useRootStore();
rootStore.setVersionCli(currentVersionName);
rootStore.setInstanceId(instanceId);
const versionsStore = useVersionsStore();
versionsStore.initialize(settings);
await versionsStore.fetchWhatsNew();
// The callout has been shown ...
expect(toast.showMessage).toHaveBeenCalled();
// ... and is immediately marked as dismissed so it does not reappear on the
// next load, even though the user never explicitly closed it.
expect(versionsStore.shouldShowWhatsNewCallout()).toBe(false);
});
it("should not fetch What's new articles if version notifications are disabled", async () => {
vi.spyOn(versionsApi, 'getWhatsNewSection');
@@ -218,10 +218,11 @@ export const useVersionsStore = defineStore(STORES.VERSIONS, () => {
data: { articleId },
});
},
onClose: () => {
dismissWhatsNewCallout();
},
});
// Mark the callout as dismissed as soon as it is shown, so it does not
// keep reappearing on subsequent loads for users who simply ignore it.
dismissWhatsNewCallout();
}
}
}