From 5b4e2ac4a96e8007bd7487f3db3d589b208dfd24 Mon Sep 17 00:00:00 2001 From: Max Strasinsky <98811342+mstrasinskis@users.noreply.github.com> Date: Tue, 24 Dec 2024 05:07:26 +0000 Subject: [PATCH] Hide the banner behind the feature flag (#6077) # Motivation [A warning was recently added](https://github.com/dfinity/nns-dapp/pull/6076) to the HW neuron creation form to inform users about the consequences of not creating a hotkey for the new neuron. This warning is intended to be part of the periodic confirmation feature, which is not yet available. However, it was mistakenly added without being gated behind the feature flag. # Changes - Move the warning behind a feature flag. # Tests - Added. # Todos - [ ] Add entry to changelog (if necessary). Not necessary. --- .../neurons/AddUserToHotkeys.svelte | 5 +++- .../neurons/NnsStakeNeuronModal.spec.ts | 29 +++++++++++++++++++ .../AddUserToHotkeys.page-object.ts | 5 ++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/neurons/AddUserToHotkeys.svelte b/frontend/src/lib/components/neurons/AddUserToHotkeys.svelte index 92d224c64c7..ff6c73b3860 100644 --- a/frontend/src/lib/components/neurons/AddUserToHotkeys.svelte +++ b/frontend/src/lib/components/neurons/AddUserToHotkeys.svelte @@ -7,6 +7,7 @@ import type { NeuronId } from "@dfinity/nns"; import { createEventDispatcher } from "svelte"; import CalloutWarning from "$lib/components/common/CalloutWarning.svelte"; + import { ENABLE_PERIODIC_FOLLOWING_CONFIRMATION } from "$lib/stores/feature-flags.store"; export let account: Account; export let neuronId: NeuronId; @@ -31,7 +32,9 @@
{$i18n.neurons.add_user_as_hotkey_message}
diff --git a/frontend/src/tests/lib/modals/neurons/NnsStakeNeuronModal.spec.ts b/frontend/src/tests/lib/modals/neurons/NnsStakeNeuronModal.spec.ts index 2a1dbecd293..601c8816526 100644 --- a/frontend/src/tests/lib/modals/neurons/NnsStakeNeuronModal.spec.ts +++ b/frontend/src/tests/lib/modals/neurons/NnsStakeNeuronModal.spec.ts @@ -14,6 +14,7 @@ import { stakeNeuron, updateDelay, } from "$lib/services/neurons.services"; +import { overrideFeatureFlagsStore } from "$lib/stores/feature-flags.store"; import { neuronsStore } from "$lib/stores/neurons.store"; import { mockIdentity, resetIdentity } from "$tests/mocks/auth.store.mock"; import { @@ -443,6 +444,34 @@ describe("NnsStakeNeuronModal", () => { expect(addHotkeyForHardwareWalletNeuron).not.toBeCalled(); }); + it("should display missing rewards warning when feature flag on", async () => { + overrideFeatureFlagsStore.setFlag( + "ENABLE_PERIODIC_FOLLOWING_CONFIRMATION", + true + ); + const po = await renderComponent({}); + await createNeuron(po); + + expect(await po.getAddUserToHotkeysPo().isPresent()).toBe(true); + expect( + await po.getAddUserToHotkeysPo().isMissingRewardsWarningVisible() + ).toBe(true); + }); + + it("should not display missing rewards warning when feature flag off", async () => { + overrideFeatureFlagsStore.setFlag( + "ENABLE_PERIODIC_FOLLOWING_CONFIRMATION", + false + ); + const po = await renderComponent({}); + await createNeuron(po); + + expect(await po.getAddUserToHotkeysPo().isPresent()).toBe(true); + expect( + await po.getAddUserToHotkeysPo().isMissingRewardsWarningVisible() + ).toBe(false); + }); + it("should create neuron for hardwareWallet and add dissolve delay", async () => { neuronsStore.setNeurons({ neurons: [newNeuron], certified: true }); const po = await renderComponent({}); diff --git a/frontend/src/tests/page-objects/AddUserToHotkeys.page-object.ts b/frontend/src/tests/page-objects/AddUserToHotkeys.page-object.ts index da1089e704c..25e1e6f440e 100644 --- a/frontend/src/tests/page-objects/AddUserToHotkeys.page-object.ts +++ b/frontend/src/tests/page-objects/AddUserToHotkeys.page-object.ts @@ -1,3 +1,4 @@ +import { CalloutWarningPo } from "$tests/page-objects/CalloutWarning.page-object"; import { BasePageObject } from "$tests/page-objects/base.page-object"; import type { PageObjectElement } from "$tests/types/page-object.types"; @@ -8,6 +9,10 @@ export class AddUserToHotkeysPo extends BasePageObject { return new AddUserToHotkeysPo(element.byTestId(AddUserToHotkeysPo.TID)); } + isMissingRewardsWarningVisible(): Promise