Move profile or studio link out of description

Prefill a new custom field for the inappropriate link instead of prefilling description.
In the popup make the link field hidden and disabled so that users don’t change it.
This commit is contained in:
Chris Garrity 2020-04-16 09:13:46 -04:00
parent 09b578bff7
commit 3111b72117
3 changed files with 10 additions and 14 deletions
src
components
helpform
helpwidget
views/contact-us

View file

@ -8,7 +8,7 @@ const HelpForm = props => {
const title = `formTitle=${props.title}`;
const username = `helpdesk_ticket[custom_field][cf_scratch_name_40167]=${props.user.username || ''}`;
const formSubject = `helpdesk_ticket[subject]=${props.subject}`;
const formDescription = `helpdesk_ticket[description]=${props.body}`;
const reportLink = `helpdesk_ticket[custom_field][cf_inappropriate_report_link_40167]=${props.body || ''}`;
return (
<div>
<script
@ -29,7 +29,7 @@ const HelpForm = props => {
height="594px"
id="freshwidget-embedded-form"
scrolling="no"
src={`${prefix}&${title}&${username}&${formSubject}&${formDescription}`}
src={`${prefix}&${title}&${username}&${formSubject}&${reportLink}`}
title={<FormattedMessage id="contactUs.questionsForum" />}
width="100%"
/>

View file

@ -58,14 +58,10 @@ class HelpWidget extends React.Component {
/* eslint-enable */
// don't show the Freshdesk button
window.FreshworksWidget('hide', 'launcher');
window.FreshworksWidget('setLabels', {
fr: {
banner: 'Bienvenue a Support',
contact_form: {
title: this.props.intl.formatMessage({id: 'contactUs.contactScratch'})
}
}
});
window.FreshworksWidget('disable', 'ticketForm', 'custom_fields.cf_inappropriate_report_link');
window.FreshworksWidget('hide', 'ticketForm', 'custom_fields.cf_inappropriate_report_link');
// open the popup already on the form if passed Inappropriate content param
this.openPopup(this.props.subject !== '');
}
@ -82,9 +78,9 @@ class HelpWidget extends React.Component {
openPopup (formOpen) {
window.FreshworksWidget('prefill', 'ticketForm', {
subject: this.props.subject,
description: this.props.body,
custom_fields: {
cf_scratch_name: this.props.user.username
cf_scratch_name: this.props.user.username,
cf_inappropriate_report_link: this.props.body
}
});
if (formOpen) {

View file

@ -25,11 +25,11 @@ class ContactUs extends React.Component {
// The subject is not localized because sending in English is easier for Scratch Team
if (query.indexOf('studio=') !== -1) {
scratchId = query.match(/studio=([0-9]+)/)[1];
this.state.subject = `Inappropriate content reported in studio ${scratchId}`;
this.state.subject = `Issue reported with studio ${scratchId}`;
this.state.body = `https://scratch.mit.edu/studios/${scratchId}`;
} else if (query.indexOf('profile=') !== -1) {
scratchId = query.match(/profile=([a-zA-Z0-9-_]+)/)[1];
this.state.subject = `Inappropriate content reported in profile ${scratchId}`;
this.state.subject = `Issue reported with profile ${scratchId}`;
this.state.body = `https://scratch.mit.edu/users/${scratchId}`;
} else if (query.indexOf('confirmation=') !== -1) {
this.state.subject = 'Problem with email confirmation';