From 975e42a582fe9fcb694648c0ae28bf96f747a67a Mon Sep 17 00:00:00 2001 From: Jose Buitron Date: Thu, 5 Oct 2023 14:42:02 -0500 Subject: [PATCH] fix: Show story map title in error message --- package-lock.json | 19 +++++++++---------- package.json | 2 +- src/localization/locales/en-US.json | 2 +- src/localization/locales/es-ES.json | 2 +- src/storyMap/components/StoryMapInvite.js | 5 ++++- .../components/StoryMapInvite.test.js | 9 ++++++++- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1f69616759..79c58bdfc6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,7 +49,7 @@ "slate-history": "^0.93.0", "slate-hyperscript": "^0.77.0", "slate-react": "^0.99.0", - "terraso-client-shared": "github:techmatters/terraso-client-shared#a0e3a5e", + "terraso-client-shared": "github:techmatters/terraso-client-shared#b86117e3735b2d8b2f85ffdb68547eb9738b9f77", "use-debounce": "^9.0.4", "uuid": "^9.0.0", "web-vitals": "^3.4.0", @@ -6726,9 +6726,9 @@ } }, "node_modules/@reduxjs/toolkit": { - "version": "1.9.5", - "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.9.5.tgz", - "integrity": "sha512-Rt97jHmfTeaxL4swLRNPD/zV4OxTes4la07Xc4hetpUW/vc75t5m1ANyxG6ymnEQ2FsLQsoMlYB2vV1sO3m8tQ==", + "version": "1.9.7", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.9.7.tgz", + "integrity": "sha512-t7v8ZPxhhKgOKtU+uyJT13lu4vL7az5aFi4IdoDs/eS548edn2M8Ik9h8fxgvMjGoAUVFSt6ZC1P5cWmQ014QQ==", "dependencies": { "immer": "^9.0.21", "redux": "^4.2.1", @@ -27346,20 +27346,19 @@ }, "node_modules/terraso-backend": { "version": "0.1.0", - "resolved": "git+ssh://git@github.com/techmatters/terraso-backend.git#8813449c8b2f4eb4b70b4add87007d2a93d25baa", - "integrity": "sha512-WXumMW1dnbEFfZjmNkRuibIuO7TDeRUQ8vr5K2nyhUs8bDZXUS67zM6TtLx92czO+PvdzI36ncH5abGHg3rpOQ==" + "resolved": "git+ssh://git@github.com/techmatters/terraso-backend.git#4929e5f4599cebc2f107873dd0075885c4df5e46" }, "node_modules/terraso-client-shared": { "version": "0.1.0", - "resolved": "git+ssh://git@github.com/techmatters/terraso-client-shared.git#691d4f0928a4b24d1a2a6506a1780a91ce26cc19", - "integrity": "sha512-lv7XZ0LZ1xx2DsVyj2EdrTKVIFSBOSy8BQdaJVng+5D5FV8IwoBGcxcEVqEOIxvnd8GLwOClUHyhO1ow72792g==", + "resolved": "git+ssh://git@github.com/techmatters/terraso-client-shared.git#b86117e3735b2d8b2f85ffdb68547eb9738b9f77", + "integrity": "sha512-33236wvHVdvHmd6R0icNzt1PWtVhqZq8nkRguDfhq5bYrH8H3MCKf1umcsJQHJ+Y4csYw6VlFSHKrIzbayIrZw==", "dependencies": { - "@reduxjs/toolkit": "^1.9.5", + "@reduxjs/toolkit": "^1.9.6", "jwt-decode": "^3.1.2", "lodash": "^4.17.21", "react": "^18.2.0", "react-redux": "^8.1.2", - "terraso-backend": "github:techmatters/terraso-backend#8813449c8b2f4eb4b70b4add87007d2a93d25baa", + "terraso-backend": "github:techmatters/terraso-backend#4929e5f", "uuid": "^9.0.0" } }, diff --git a/package.json b/package.json index 58da960457..51c7e71328 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "slate-history": "^0.93.0", "slate-hyperscript": "^0.77.0", "slate-react": "^0.99.0", - "terraso-client-shared": "github:techmatters/terraso-client-shared#a0e3a5e", + "terraso-client-shared": "github:techmatters/terraso-client-shared#b86117e3735b2d8b2f85ffdb68547eb9738b9f77", "use-debounce": "^9.0.4", "uuid": "^9.0.0", "web-vitals": "^3.4.0", diff --git a/src/localization/locales/en-US.json b/src/localization/locales/en-US.json index 0de89b86c9..06750736bd 100644 --- a/src/localization/locales/en-US.json +++ b/src/localization/locales/en-US.json @@ -1015,7 +1015,7 @@ "approved_membership": "You have been added to “{{storyMapTitle}}”", "approve_invite_success": "You have been added to “{{storyMapTitle}}”", "approveMembership.update_not_allowed": "Unable to accept Story Map invitation", - "approveMembership.update_not_allowed_permissions_validation": "You can't accept the invitation for the Story Map “{{storyMapTitle}}.” You must be logged in using the email address shown in the invitation.", + "approveMembership.update_not_allowed_permissions_validation": "You can't accept the invitation for the Story Map “{{storyMapTitle}}”. You must be logged in using the email address shown in the invitation.", "invite_document_title": "Story Map Invite" }, "site": { diff --git a/src/localization/locales/es-ES.json b/src/localization/locales/es-ES.json index 91ad9f4acb..0303139456 100644 --- a/src/localization/locales/es-ES.json +++ b/src/localization/locales/es-ES.json @@ -1022,7 +1022,7 @@ "approved_membership": "Te han agregado a “{{storyMapTitle}}”", "approve_invite_success": "Te han agregado a “{{storyMapTitle}}”", "approveMembership.update_not_allowed": "No se puede aceptar la invitación de Story Map", - "approveMembership.update_not_allowed_permissions_validation": "No puedes aceptar esta invitación de Story Map. Debes iniciar sesión con la dirección de correo electrónico que se muestra en la invitación.", + "approveMembership.update_not_allowed_permissions_validation": "No puedes aceptar la invitación para el Story Map “{{storyMapTitle}}”. Debes iniciar sesión con la dirección de correo electrónico que se muestra en la invitación.", "invite_document_title": "Invitación a Story Map" }, "site": { diff --git a/src/storyMap/components/StoryMapInvite.js b/src/storyMap/components/StoryMapInvite.js index 75b159977f..a28a606d5c 100644 --- a/src/storyMap/components/StoryMapInvite.js +++ b/src/storyMap/components/StoryMapInvite.js @@ -83,7 +83,10 @@ const StoryMapInvite = () => { {error?.parsedErrors.map((error, index) => ( - {t(error.content, error.params)} + {t(error.content, { + ...error.params, + storyMapTitle: error.params?.response?.storyMap?.title, + })} ))} diff --git a/src/storyMap/components/StoryMapInvite.test.js b/src/storyMap/components/StoryMapInvite.test.js index 440f82d2c7..580cfba84e 100644 --- a/src/storyMap/components/StoryMapInvite.test.js +++ b/src/storyMap/components/StoryMapInvite.test.js @@ -137,6 +137,13 @@ test('StoryMapInvite: Different user token', async () => { mockTerrasoAPIrequestGraphQL({ 'mutation approveMembershipToken': Promise.reject({ content: 'update_not_allowed_permissions_validation', + params: { + response: { + storyMap: { + title: 'Story Map title', + }, + }, + }, }), }); @@ -144,7 +151,7 @@ test('StoryMapInvite: Different user token', async () => { expect( within(screen.getByRole('alert')).getByText( - /You can't accept this Story Map invitation. You must be logged in using the email address shown in the invitation/i + /You can't accept the invitation for the Story Map “Story Map title”. You must be logged in using the email address shown in the invitation./i ) ).toBeInTheDocument();