Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HubSpot: check that email is unknown before populating firstSourceURL #2765

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
HubSpot: check that form email input is not-prepopulated before addin…
…g firstSourceURL
  • Loading branch information
attfarhan committed Mar 15, 2021
commit 9669068ccac7766626d2dc9aa2382f42be74608d
8 changes: 7 additions & 1 deletion website/src/components/HubSpot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ export function createHubSpotForm({ portalId, formId, targetId, onFormSubmit, on
}

const firstSourceURLInput = form.querySelector<HTMLInputElement>('input[name="first_source_url"]')
if (firstSourceURLInput && firstSourceURLInput.value === '') {
const emailInput = form.querySelector<HTMLInputElement>('input[name="email"]')
if (
firstSourceURLInput &&
firstSourceURLInput.value === '' &&
emailInput &&
emailInput.value === ''
) {
// Populate the hidden first_source_url form field with the value from the sourcegraphSourceUrl cookie.
firstSourceURLInput.value = firstSourceURL || ''
}
Expand Down