From 0b362380d444dcf087356b6c6279603f350f336e Mon Sep 17 00:00:00 2001 From: Shaun Hamilton Date: Thu, 11 Nov 2021 21:57:26 +0000 Subject: [PATCH] fix(client): remove url parameters from forum href (#44157) * fix(client): remove url parameters from forum href * add tests for removeUrlParamters * use URL API, Shaun's preferred method --- .../src/templates/Challenges/redux/create-question-epic.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/templates/Challenges/redux/create-question-epic.js b/client/src/templates/Challenges/redux/create-question-epic.js index a40d2bb7b3..7ddd89f8bb 100644 --- a/client/src/templates/Challenges/redux/create-question-epic.js +++ b/client/src/templates/Challenges/redux/create-question-epic.js @@ -38,8 +38,10 @@ function createQuestionEpic(action$, state$, { window }) { challengeMetaSelector(state); const { navigator: { userAgent }, - location: { href } + location: { pathname, origin } } = window; + // Removes query params + const challengeUrl = new URL(pathname, origin).href; const projectFormValues = Object.entries( projectFormValuesSelector(state) ); @@ -51,7 +53,7 @@ function createQuestionEpic(action$, state$, { window }) { 'forum-help.challenge' )} ${challengeTitle}\n\n${i18next.t( 'forum-help.challenge-link' - )}\n${href}` + )}\n${challengeUrl}` ); let textMessage = dedent(`${i18next.t(