From cc9e880d7a1c078d3db6468665638effd18c4d87 Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Tue, 31 Oct 2023 15:36:06 -0400 Subject: [PATCH] update toast copy --- cypress/integration/myPatches/patchCard/dropdown_menu.ts | 4 ++-- src/components/PatchActionButtons/SetPatchVisibility.tsx | 8 ++++++-- src/gql/generated/types.ts | 6 +++++- src/gql/mutations/set-patch-visibility.graphql | 1 + 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cypress/integration/myPatches/patchCard/dropdown_menu.ts b/cypress/integration/myPatches/patchCard/dropdown_menu.ts index 115bfd9de3..46c5f65660 100644 --- a/cypress/integration/myPatches/patchCard/dropdown_menu.ts +++ b/cypress/integration/myPatches/patchCard/dropdown_menu.ts @@ -117,7 +117,7 @@ describe("Dropdown Menu of Patch Actions", { testIsolation: false }, () => { cy.dataCy("patch-card-dropdown").click(); }); cy.contains("Hide patch").should("be.visible").click(); - cy.validateToast("success", "Successfully updated patch visibility."); + cy.validateToast("success", "This patch was successfully hidden."); cy.get("@targetPatchCard").should("not.exist"); // Check "Include hidden" checkbox and unhide patch card cy.dataCy("include-hidden-checkbox").check({ force: true }); @@ -149,7 +149,7 @@ describe("Dropdown Menu of Patch Actions", { testIsolation: false }, () => { }); // Test unhide button cy.contains("Unhide patch").should("be.visible").click(); - cy.validateToast("success", "Successfully updated patch visibility."); + cy.validateToast("success", "This patch was successfully unhidden."); cy.get("@targetPatchCard") .should("be.visible") .within(() => { diff --git a/src/components/PatchActionButtons/SetPatchVisibility.tsx b/src/components/PatchActionButtons/SetPatchVisibility.tsx index d9f7f09673..8c2d966897 100644 --- a/src/components/PatchActionButtons/SetPatchVisibility.tsx +++ b/src/components/PatchActionButtons/SetPatchVisibility.tsx @@ -24,8 +24,12 @@ export const SetPatchVisibility: React.FC = ({ SetPatchVisibilityMutation, SetPatchVisibilityMutationVariables >(SET_PATCH_VISIBILITY, { - onCompleted: () => { - dispatchToast.success("Successfully updated patch visibility."); + onCompleted: (d) => { + dispatchToast.success( + `This patch was successfully ${ + d.setPatchVisibility?.[0].hidden ? "unhidden" : "hidden" + }` + ); }, onError: (err) => { dispatchToast.error(`Unable to update patch visibility: ${err.message}`); diff --git a/src/gql/generated/types.ts b/src/gql/generated/types.ts index 6ec11f83de..69b200c987 100644 --- a/src/gql/generated/types.ts +++ b/src/gql/generated/types.ts @@ -5035,7 +5035,11 @@ export type SetPatchVisibilityMutationVariables = Exact<{ export type SetPatchVisibilityMutation = { __typename?: "Mutation"; - setPatchVisibility: Array<{ __typename?: "Patch"; id: string }>; + setPatchVisibility: Array<{ + __typename?: "Patch"; + hidden: boolean; + id: string; + }>; }; export type SetTaskPriorityMutationVariables = Exact<{ diff --git a/src/gql/mutations/set-patch-visibility.graphql b/src/gql/mutations/set-patch-visibility.graphql index 65d5bf0838..7c742187f9 100644 --- a/src/gql/mutations/set-patch-visibility.graphql +++ b/src/gql/mutations/set-patch-visibility.graphql @@ -1,5 +1,6 @@ mutation SetPatchVisibility($patchIds: [String!]!, $hidden: Boolean!) { setPatchVisibility(patchIds: $patchIds, hidden: $hidden) { + hidden id } }