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
pull/44163/head
Shaun Hamilton 2021-11-11 21:57:26 +00:00 committed by GitHub
parent 95923c11c7
commit 0b362380d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -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(