Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
update toast copy
Browse files Browse the repository at this point in the history
  • Loading branch information
SupaJoon committed Oct 31, 2023
1 parent a4ef717 commit cc9e880
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cypress/integration/myPatches/patchCard/dropdown_menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down Expand Up @@ -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(() => {
Expand Down
8 changes: 6 additions & 2 deletions src/components/PatchActionButtons/SetPatchVisibility.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ export const SetPatchVisibility: React.FC<Props> = ({
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}`);
Expand Down
6 changes: 5 additions & 1 deletion src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<{
Expand Down
1 change: 1 addition & 0 deletions src/gql/mutations/set-patch-visibility.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mutation SetPatchVisibility($patchIds: [String!]!, $hidden: Boolean!) {
setPatchVisibility(patchIds: $patchIds, hidden: $hidden) {
hidden
id
}
}

0 comments on commit cc9e880

Please sign in to comment.